/* ============================================================
   promo.css - tipped-in advertisement card
   Self-contained: defines its own palette tokens scoped to the
   promo subtree, so the card renders identically on any host
   theme (chronicle / gazette / brief / ledger / dossier ...).
   ============================================================ */

.promo-backdrop,
.promo,
.promo-loading {
  --paper-card: #f8f4ea;
  --paper-deep: #e8dfcc;
  --ink: #332b21;
  --ink-soft: #594d43;
  --ink-faint: #6b6155;
  --rule: #d4c9b3;
  --rule-strong: #b9ad97;
  --wax: #9d2b2b;
  --wax-deep: #7b1f1f;
  --font-text: 'EB Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-meta: 'Public Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

.promo-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(28, 23, 17, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.promo-backdrop[data-open="yes"] {
  opacity: 1;
  pointer-events: auto;
}

/* The card sits like an insert tipped into a bound volume: slightly
   off-square, one wax seal, hairline rules. Not a SaaS modal. */
.promo {
  position: fixed;
  z-index: 91;
  left: 50%;
  top: 50%;
  width: min(calc(100vw - 32px), 452px);
  transform: translate(-50%, -46%) rotate(-0.4deg);
  background: var(--paper-card);
  border: 1px solid var(--rule-strong);
  box-shadow: 0 18px 48px rgba(28, 23, 17, 0.28);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 320ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 320ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.promo[data-open="yes"] {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) rotate(-0.4deg);
}

/* Header strip: the honest label. This is an advertisement and the card
   says so on its face, in the same voice as the plate tabs. */
.promo__tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px 9px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-deep);
}

.promo__label {
  font-family: var(--font-meta);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.promo__close {
  appearance: none;
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-meta);
  font-size: 15px;
  line-height: 1;
  width: 30px;
  height: 30px;
  cursor: pointer;
  border-radius: 0;
  transition: color 160ms ease, border-color 160ms ease;
}

@media (hover: hover) {
  .promo__close:hover { color: var(--ink); border-color: var(--ink-soft); }
}

.promo__close:focus-visible {
  outline: 2px solid var(--wax);
  outline-offset: 2px;
}

.promo__close:active { transform: scale(0.94); }

.promo__body { padding: 22px 24px 24px; }

.promo__seal {
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
}

.promo__title {
  font-family: var(--font-text);
  font-size: clamp(21px, 4.6vw, 26px);
  font-weight: 500;
  line-height: 1.22;
  color: var(--ink);
  margin: 0 0 10px;
}

.promo__text {
  font-family: var(--font-text);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 18px;
  max-width: 42ch;
}

.promo__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--wax);
  color: var(--paper-card);
  font-family: var(--font-meta);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  border: 1px solid var(--wax-deep);
  transition: background 160ms ease;
}

@media (hover: hover) {
  .promo__cta:hover { background: var(--wax-deep); }
}

.promo__cta:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.promo__cta:active { transform: scale(0.975); }

.promo__cta svg { width: 13px; height: 13px; flex: none; }

/* The small print is not a disclaimer graveyard: it carries the age gate
   and the fact that this is paid placement, at readable size. */
.promo__fine {
  margin: 16px 0 0;
  padding-top: 13px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-meta);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

.promo__fine a { color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  .promo-backdrop,
  .promo { transition: none; }
  .promo { transform: translate(-50%, -50%) rotate(-0.4deg); }
  .promo__close:active,
  .promo__cta:active { transform: none; }
}
/* ============================================================
   Загрузочный оверлей: блюр на весь экран + спиннер,
   пока идёт проверка и до момента редиректа.
   ============================================================ */
.promo-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 23, 17, 0.32);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  opacity: 0;
  transition: opacity 240ms cubic-bezier(0.23, 1, 0.32, 1);
}

.promo-loading[data-open="yes"] { opacity: 1; }

.promo-loading__spinner {
  width: 54px;
  height: 54px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: promo-spin 0.8s linear infinite;
}

@keyframes promo-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .promo-loading { transition: none; }
  .promo-loading__spinner { animation-duration: 1.6s; }
}
