/*!
 * plg_system_tcform: кнопка по шорткоду [tcform] и окно формы в стиле сайта.
 * (C) 2026 Иван Белов. GPL-2.0-or-later.
 * Цвета берутся из переменных оформления tc4 (--navy, --cta1, --cta2 ...), запасные значения заданы здесь.
 */

/* ---------- кнопка ---------- */
.tc-frm { display: block; margin: 14px 0; line-height: 1; }
.tc-frm--inline { display: inline-block; margin: 4px 6px 4px 0; vertical-align: middle; }
.tc-frm--right { text-align: right; }
.tc-frm--center { text-align: center; }
.tc-frm--left { text-align: left; }
body.site .tc-frm .tc-frm-btn {
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
  min-height: 44px; padding: 12px 26px; border-radius: 999px; border: 1px solid transparent;
  font: 600 12px/1.2 var(--sans, 'Manrope', system-ui, sans-serif); letter-spacing: .13em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; text-shadow: none; white-space: nowrap;
  transition: transform .25s ease, filter .25s ease, box-shadow .25s ease;
  -webkit-tap-highlight-color: transparent;
}
body.site .tc-frm .tc-frm-btn--gold {
  background: linear-gradient(180deg, var(--cta1, #E4CB92), var(--cta2, #C69F58)); color: var(--cta-ink, #2C2109);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 14px 24px -12px rgba(120, 86, 24, .65);
}
body.site .tc-frm .tc-frm-btn--glass {
  background: rgba(255, 255, 255, .82); color: var(--navy, #22374D); border-color: #fff;
  box-shadow: inset 0 2px 6px rgba(38, 58, 84, .06), 0 14px 26px -16px rgba(38, 58, 84, .45);
}
body.site .tc-frm .tc-frm-btn--line { background: transparent; color: var(--navy, #22374D); border-color: var(--b-d, #35516E); }
body.site .tc-frm .tc-frm-btn:hover { transform: translateY(-2px); filter: brightness(1.04); color: inherit; }
body.site .tc-frm .tc-frm-btn--gold:hover { color: var(--cta-ink, #2C2109); }
body.site .tc-frm .tc-frm-btn:focus-visible { outline: 3px solid rgba(127, 152, 178, .6); outline-offset: 3px; }
@media (max-width: 767px) {
  body.site .tc-frm:not(.tc-frm--inline) .tc-frm-btn { width: 100%; white-space: normal; text-align: center; }
  body.site .tc-frm--inline { display: block; margin: 12px 0; }
  body.site .tc-frm--inline .tc-frm-btn { width: 100%; white-space: normal; text-align: center; }
}

/* ---------- окно ---------- */
html.tc-frm-lock { overflow: hidden; }
.tc-frm-modal[hidden] { display: none !important; }
.tc-frm-modal {
  position: fixed; inset: 0; z-index: 100050; display: flex; align-items: center; justify-content: center;
  padding: 24px; box-sizing: border-box; font-family: var(--sans, 'Manrope', system-ui, sans-serif);
  opacity: 0; transition: opacity .22s ease;
}
.tc-frm-modal.is-open { opacity: 1; }
.tc-frm-backdrop {
  position: absolute; inset: 0; background: rgba(24, 38, 56, .56);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.tc-frm-modal .tc-frm-panel {
  position: relative; box-sizing: border-box; width: 100%; max-width: 580px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 38px 42px 34px; border-radius: 32px; color: var(--ink, #2A323B); outline: 0;
  background: radial-gradient(420px 220px at 100% 0, rgba(228, 203, 146, .22), rgba(228, 203, 146, 0) 70%), linear-gradient(180deg, #fff, #F4F7FA);
  border: 1px solid #fff; box-shadow: 0 40px 80px -24px rgba(18, 32, 48, .7), 0 2px 0 rgba(255, 255, 255, .8) inset;
  transform: translateY(14px) scale(.98); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.tc-frm-modal.is-open .tc-frm-panel { transform: none; }
.tc-frm-modal .tc-frm-x {
  position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; display: grid; place-items: center; padding: 0;
  border-radius: 50%; border: 1px solid #D6E1EC; background: #fff; color: var(--b-d, #35516E); cursor: pointer;
  transition: background .2s, color .2s;
}
.tc-frm-modal .tc-frm-x:hover { background: var(--navy, #22374D); color: #fff; }
.tc-frm-modal .tc-frm-x:focus-visible { outline: 3px solid rgba(127, 152, 178, .6); outline-offset: 2px; }
.tc-frm-body[hidden] { display: none !important; }

.tc-frm-head { display: flex; align-items: center; gap: 14px; padding-right: 48px; margin: 0 0 14px; }
.tc-frm-star {
  flex: none; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%;
  background: #fff; border: 1px solid #D6E1EC; box-shadow: 0 10px 20px -12px rgba(38, 58, 84, .5);
}
.tc-frm-star img { display: block; width: 34px; height: 34px; }
.tc-frm-modal p.tc-frm-eyebrow { margin: 0 0 4px; font: 700 11px/1.2 var(--sans, 'Manrope', sans-serif); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3, #6C7883); }
.tc-frm-modal h2.tc-frm-title {
  margin: 0; padding: 0; font: 600 34px/1.1 var(--serif, 'Cormorant Garamond', Georgia, serif); letter-spacing: 0; text-transform: none;
  color: var(--navy, #22374D) !important; outline: 0;
}
.tc-frm-modal p.tc-frm-topic { margin: -6px 0 18px; padding: 9px 14px; border-radius: 14px; background: rgba(228, 203, 146, .26); border: 1px solid rgba(198, 159, 88, .45); color: var(--navy, #22374D); font: 600 14px/1.4 var(--sans, 'Manrope', sans-serif); }
.tc-frm-modal p.tc-frm-topic[hidden] { display: none; }
.tc-frm-modal p.tc-frm-intro { margin: 0 0 22px; font: 400 15px/1.6 var(--sans, 'Manrope', sans-serif); color: var(--ink-2, #4B5762); }

.tc-frm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.tc-frm-field { min-width: 0; }
.tc-frm-field--full { grid-column: 1 / -1; }
.tc-frm-modal label.tc-frm-label { display: block; margin: 0 0 7px; font: 700 13px/1.3 var(--sans, 'Manrope', sans-serif); color: var(--ink-2, #4B5762); letter-spacing: .01em; }
.tc-frm-req { color: #B58A3D; }
.tc-frm-modal .tc-frm-input.tc-frm-input {
  display: block; width: 100%; box-sizing: border-box; min-height: 52px; margin: 0; padding: 13px 16px;
  font: 400 16px/1.4 var(--sans, 'Manrope', sans-serif); color: var(--ink, #2A323B);
  background: #F7FAFC; border: 1px solid #D6E1EC; border-radius: 16px; box-shadow: none;
  transition: border-color .2s, box-shadow .2s, background .2s; -webkit-appearance: none; appearance: none;
}
.tc-frm-modal textarea.tc-frm-input.tc-frm-input { min-height: 124px; resize: vertical; padding-top: 14px; }
.tc-frm-modal .tc-frm-input::placeholder { color: #8A96A1; opacity: 1; }
.tc-frm-modal .tc-frm-input:hover { border-color: #B9C9D9; }
.tc-frm-modal .tc-frm-input:focus { outline: 0; background: #fff; border-color: #7F98B2; box-shadow: 0 0 0 4px rgba(127, 152, 178, .28); }
.tc-frm-selectwrap { position: relative; }
.tc-frm-selectwrap::after {
  content: ''; position: absolute; right: 20px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--b-d, #35516E); border-bottom: 2px solid var(--b-d, #35516E); transform: rotate(45deg); pointer-events: none;
}
.tc-frm-modal .tc-frm-select.tc-frm-input.tc-frm-input { padding-right: 44px; cursor: pointer; text-overflow: ellipsis; }
.tc-frm-modal .tc-frm-input[aria-invalid="true"] { border-color: #D9786A; background: #FFF7F5; }
.tc-frm-modal .tc-frm-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(217, 120, 106, .22); }
.tc-frm-modal p.tc-frm-fe { margin: 6px 2px 0; font: 600 13px/1.35 var(--sans, 'Manrope', sans-serif); color: #B3412F; }
.tc-frm-modal p.tc-frm-fe[hidden], .tc-frm-modal p.tc-frm-error[hidden] { display: none; }
.tc-frm-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.tc-frm-consent { margin: 18px 0 4px; }
.tc-frm-check { position: relative; display: flex; align-items: flex-start; gap: 12px; margin: 0; cursor: pointer; font: 400 14px/1.5 var(--sans, 'Manrope', sans-serif); color: var(--ink-2, #4B5762); }
.tc-frm-check input { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: 0; opacity: 0; cursor: pointer; }
.tc-frm-box {
  flex: none; width: 24px; height: 24px; margin-top: 0; box-sizing: border-box; border-radius: 8px; border: 1.5px solid #9DB0C3; background: #fff;
  display: grid; place-items: center; transition: background .2s, border-color .2s, box-shadow .2s;
}
.tc-frm-box::after { content: ''; width: 6px; height: 11px; margin-top: -2px; border: solid #fff; border-width: 0 2.4px 2.4px 0; transform: rotate(45deg) scale(0); transition: transform .15s; }
.tc-frm-check input:checked + .tc-frm-box { background: var(--navy, #22374D); border-color: var(--navy, #22374D); }
.tc-frm-check input:checked + .tc-frm-box::after { transform: rotate(45deg) scale(1); }
.tc-frm-check input:focus-visible + .tc-frm-box { box-shadow: 0 0 0 4px rgba(127, 152, 178, .4); }
.tc-frm-check input[aria-invalid="true"] + .tc-frm-box { border-color: #D9786A; background: #FFF7F5; }
.tc-frm-checktext { padding-top: 1px; }
.tc-frm-checktext a { color: var(--b-d, #35516E); text-decoration: underline; text-underline-offset: 3px; }

.tc-frm-modal p.tc-frm-error { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: #FFF1EE; border: 1px solid #F0C3BB; color: #9E3A2A; font: 600 14px/1.45 var(--sans, 'Manrope', sans-serif); }

.tc-frm-modal .tc-frm-send {
  position: relative; display: flex; align-items: center; justify-content: center; width: 100%; box-sizing: border-box;
  min-height: 56px; margin: 22px 0 0; padding: 14px 24px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, var(--cta1, #E4CB92), var(--cta2, #C69F58)); color: var(--cta-ink, #2C2109);
  font: 700 13px/1.2 var(--sans, 'Manrope', sans-serif); letter-spacing: .12em; text-transform: uppercase; text-shadow: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 16px 26px -14px rgba(120, 86, 24, .7);
  transition: transform .25s, filter .25s, opacity .2s;
}
.tc-frm-modal .tc-frm-send:hover { transform: translateY(-1px); filter: brightness(1.04); }
.tc-frm-modal .tc-frm-send:focus-visible { outline: 3px solid rgba(127, 152, 178, .7); outline-offset: 3px; }
.tc-frm-modal .tc-frm-send[disabled] { cursor: default; transform: none; filter: none; opacity: .9; }
.tc-frm-modal .tc-frm-send--ghost { background: #fff; color: var(--navy, #22374D); border: 1px solid #D6E1EC; box-shadow: none; }
.tc-frm-spin { position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(44, 33, 9, .25); border-top-color: var(--cta-ink, #2C2109); opacity: 0; }
.tc-frm-send.is-busy .tc-frm-send-t { opacity: 0; }
.tc-frm-send.is-busy .tc-frm-spin { opacity: 1; animation: tc-frm-rot .8s linear infinite; }
@keyframes tc-frm-rot { to { transform: rotate(360deg); } }
.tc-frm-modal p.tc-frm-note { margin: 12px 0 0; font: 400 12.5px/1.5 var(--sans, 'Manrope', sans-serif); color: var(--ink-3, #6C7883); text-align: center; }

.tc-frm-done { text-align: center; padding: 14px 0 6px; }
.tc-frm-ok {
  display: inline-grid; place-items: center; width: 72px; height: 72px; margin: 0 0 18px; border-radius: 50%;
  background: linear-gradient(180deg, var(--cta1, #E4CB92), var(--cta2, #C69F58)); color: var(--cta-ink, #2C2109);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 18px 28px -14px rgba(120, 86, 24, .7);
}
.tc-frm-done .tc-frm-intro { max-width: 420px; margin: 12px auto 24px; }
.tc-frm-done .tc-frm-send { max-width: 280px; margin: 0 auto; }

/* телефон: окно выезжает снизу */
@media (max-width: 640px) {
  .tc-frm-modal { align-items: flex-end; padding: 0; }
  .tc-frm-modal .tc-frm-panel {
    max-width: none; max-height: 94vh; max-height: 94dvh; border-radius: 28px 28px 0 0;
    padding: 30px 18px calc(22px + env(safe-area-inset-bottom, 0px));
    transform: translateY(40px); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  }
  .tc-frm-modal .tc-frm-panel::before {
    content: ''; position: absolute; top: 10px; left: 50%; width: 44px; height: 4px; margin-left: -22px; border-radius: 4px; background: #CBD6E1;
  }
  .tc-frm-modal .tc-frm-x { top: 14px; right: 10px; }
  .tc-frm-head { gap: 12px; padding-right: 48px; margin-bottom: 10px; }
  .tc-frm-star { width: 46px; height: 46px; }
  .tc-frm-star img { width: 28px; height: 28px; }
  .tc-frm-modal h2.tc-frm-title { font-size: 28px; }
  .tc-frm-modal p.tc-frm-intro { font-size: 14.5px; margin-bottom: 18px; }
  .tc-frm-grid { grid-template-columns: 1fr; gap: 14px; }
  .tc-frm-field--half { grid-column: 1 / -1; }
  .tc-frm-modal textarea.tc-frm-input.tc-frm-input { min-height: 112px; }
}
@media (max-width: 380px) {
  .tc-frm-modal .tc-frm-panel { padding-left: 16px; padding-right: 16px; }
  .tc-frm-modal h2.tc-frm-title { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .tc-frm-modal, .tc-frm-modal .tc-frm-panel, body.site .tc-frm .tc-frm-btn { transition: none; }
  .tc-frm-send.is-busy .tc-frm-spin { animation-duration: 2s; }
}

