/* ============================================================
   Генератор UTM-меток (.bcu), 01.10.2026.
   Работает в статьях (шорткод [bc_utm]) и на странице
   /instrumenty/generator-utm-metok/. Токены из bc2.css с запасными
   значениями, как у калькуляторов (.bcc). Раскладка по ширине
   самого блока (container query): в статье и рядом с боковой
   колонкой инструмента места разное.
   Поля не мельче 16px, иначе iPhone увеличивает страницу при фокусе.
   ============================================================ */

.bcu {
  --bcu-ink: var(--ink, #0B0F14);
  --bcu-ink2: var(--ink-2, #1A222C);
  --bcu-muted: var(--muted, #5C6875);
  --bcu-line: var(--line, #DCE3EB);
  --bcu-wash: var(--wash, #EFF2F6);
  --bcu-acc: var(--accent, #0FB5AE);
  --bcu-deep: var(--accent-deep, #068C86);
  --bcu-good: var(--money, #0E7C55);
  --bcu-bad: #C2412D;
  --bcu-warn: #9A5B00;
  --bcu-tint: #F1FAF9;
  --bcu-mono: var(--f-mono, "JetBrains Mono", ui-monospace, monospace);
  container-type: inline-size;
  position: relative;
  margin: 30px 0;
  background: #fff;
  border: 1px solid var(--bcu-line);
  border-radius: 18px;
  color: var(--bcu-ink);
  font-family: var(--f-ui, "Onest", "Segoe UI", system-ui, sans-serif);
  font-size: 16px;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(11, 15, 20, .04), 0 24px 48px -40px rgba(11, 15, 20, .35);
  overflow: hidden;
  scroll-margin-top: 96px;
}
.bcu *, .bcu *::before, .bcu *::after { box-sizing: border-box; }
.bcu p, .bcu dl, .bcu dd, .bcu dt, .bcu ul, .bcu li { margin: 0; padding: 0; }
.bcu ul { list-style: none; }
.bcu button { font: inherit; }
.bcu [hidden] { display: none !important; }
.bcu code { font-family: var(--bcu-mono); background: none; padding: 0; border: 0; color: inherit; font-size: inherit; }

.bcu__boot { padding: 26px 20px; color: var(--bcu-muted); font-size: 15px; }
.bcu__nojs { padding: 0 20px 20px; color: var(--bcu-muted); font-size: 15px; }

/* шапка */
.bcu__head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--bcu-line); }
.bcu__tag {
  flex: 0 0 auto; display: inline-grid; place-items: center; min-width: 50px; height: 34px; padding: 0 9px;
  border-radius: 10px; background: var(--bcu-ink); color: #fff;
  font: 700 13px/1 var(--bcu-mono); letter-spacing: .04em;
}
.bcu__ttl { flex: 1 1 auto; min-width: 0; }
.bcu__title { font-size: 18px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.bcu__sub { margin-top: 2px; font-size: 14px; color: var(--bcu-muted); line-height: 1.35; }

/* площадки */
.bcu__top { padding: 14px 20px 0; }
.bcu__cap, .bcu__mcap { font-size: 13px; font-weight: 600; color: var(--bcu-muted); margin-bottom: 8px; }
.bcu__plats { display: flex; flex-wrap: wrap; gap: 6px; }
.bcu__plat {
  height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--bcu-line); background: #fff; color: var(--bcu-ink2);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.bcu__plat:hover { border-color: var(--bcu-acc); color: var(--bcu-deep); }
.bcu__plat.is-on { background: var(--bcu-ink); border-color: var(--bcu-ink); color: #fff; }
.bcu .bcu__where { margin: 10px 0 0; font-size: 13.5px; color: var(--bcu-ink2); line-height: 1.4; }

/* тело: форма и результат рядом, в узком блоке друг под другом */
/* В узком блоке ссылка идёт сразу под полями, макросы и настройки ниже. */
.bcu__body { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "res" "more"; }
.bcu__body > .bcu__form { grid-area: main; }
.bcu__body > .bcu__res { grid-area: res; }
.bcu__body > .bcu__form--more { grid-area: more; border-top: 1px solid var(--bcu-line); }
@container (min-width: 820px) {
  .bcu__body { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-areas: "main res" "more res"; grid-template-rows: auto 1fr; }
  .bcu__body > .bcu__form--more { border-top: 0; padding-top: 0; }
  .bcu__res { border-left: 1px solid var(--bcu-line); border-top: 0 !important; }
}
.bcu__form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
  align-content: start; padding: 16px 20px 20px;
}
.bcu__fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bcu__fld--wide, .bcu__macros { grid-column: 1 / -1; }
.bcu__lbl { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--bcu-ink); line-height: 1.3; }
.bcu__lbl code { font-size: 13px; font-weight: 600; }
.bcu__req { font-size: 11.5px; font-weight: 600; color: var(--bcu-deep); }
.bcu__ctl {
  display: flex; align-items: center; height: 46px; min-width: 0;
  background: #fff; border: 1px solid #D3DBE4; border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.bcu__ctl:hover { border-color: #B9C5D1; }
.bcu__ctl:focus-within { border-color: var(--bcu-acc); box-shadow: 0 0 0 3px rgba(15, 181, 174, .16); }
.bcu .bcu__in {
  flex: 1 1 auto; width: 100%; min-width: 0; height: 100%; margin: 0; padding: 0 12px;
  border: 0; outline: none; background: none; box-shadow: none;
  font: 500 16px/1 var(--bcu-mono); color: var(--bcu-ink);
}
.bcu .bcu__in::placeholder { color: #9AA6B2; font-family: var(--f-ui, "Onest", system-ui, sans-serif); font-weight: 400; font-size: 15px; }
.bcu .bcu__in--url { font-family: var(--f-ui, "Onest", system-ui, sans-serif); }
.bcu__hint { font-size: 12.5px; color: var(--bcu-muted); line-height: 1.35; }

/* макросы */
.bcu__macros { padding: 12px; border-radius: 12px; background: var(--bcu-wash); }
.bcu__mlist { display: flex; flex-wrap: wrap; gap: 6px; }
.bcu__chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--bcu-line); background: #fff; color: var(--bcu-ink2); text-align: left;
  font-size: 12.5px; line-height: 1.2; transition: border-color .15s, background .15s;
}
.bcu__chip code { font-size: 12.5px; font-weight: 700; color: var(--bcu-deep); }
.bcu__chip { max-width: 100%; }
.bcu__chip code { flex: 0 0 auto; }
.bcu__chip span { color: var(--bcu-muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcu__chip:hover { border-color: var(--bcu-acc); }
.bcu__chip--all { font-weight: 600; color: var(--bcu-deep); border-style: dashed; }

/* свои параметры */
.bcu__extra { display: grid; gap: 8px; }
.bcu__extra:empty { display: none; }
.bcu__xrow { display: grid; grid-template-columns: minmax(0, .8fr) auto minmax(0, 1.2fr) 40px; align-items: center; gap: 6px; }
.bcu__eq { color: var(--bcu-muted); font: 600 15px/1 var(--bcu-mono); }
.bcu__del {
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer; border: 1px solid var(--bcu-line); background: #fff;
  color: var(--bcu-muted); font-size: 20px; line-height: 1;
}
.bcu__del:hover { color: var(--bcu-bad); border-color: var(--bcu-bad); }
.bcu__addrow { display: flex; flex-wrap: wrap; gap: 8px; }
.bcu__add {
  height: 36px; padding: 0 13px; border-radius: 10px; cursor: pointer;
  border: 1px dashed #B9C5D1; background: #fff; color: var(--bcu-ink2); font-size: 14px; font-weight: 600;
}
.bcu__add:hover { border-color: var(--bcu-acc); color: var(--bcu-deep); }

/* настройки */
.bcu__opts { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.bcu__opt { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--bcu-ink2); cursor: pointer; }
.bcu__opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--bcu-deep); }

/* результат */
.bcu__res {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: 16px 20px 20px; background: var(--bcu-tint); border-top: 1px solid var(--bcu-line);
}
.bcu__rl { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; font-weight: 600; color: var(--bcu-deep); text-transform: uppercase; letter-spacing: .05em; }
.bcu__len { font-size: 12.5px; color: var(--bcu-muted); text-transform: none; letter-spacing: 0; font-weight: 500; }
.bcu__url {
  padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid #BFD9D6;
  font: 500 14px/1.6 var(--bcu-mono); color: var(--bcu-ink2); overflow-wrap: anywhere; word-break: break-all;
}
.bcu.is-bad .bcu__url { color: #9AA6B2; font-family: var(--f-ui, system-ui, sans-serif); }
.bcu__ub { color: var(--bcu-ink); }
.bcu__us { color: var(--bcu-muted); }
.bcu__uk { color: var(--bcu-deep); font-weight: 700; }
.bcu__uv { color: var(--bcu-ink); }
.bcu__uv mark { background: #FFF1C9; color: #6B4A00; border-radius: 4px; padding: 0 2px; }
.bcu__acts { display: flex; gap: 8px; flex-wrap: wrap; }
.bcu__btn {
  height: 40px; padding: 0 15px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--bcu-ink); background: var(--bcu-ink); color: #fff;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.bcu__btn:hover { background: var(--bcu-ink2); }
.bcu__btn:disabled { opacity: .45; cursor: default; }
.bcu__btn.is-done { background: var(--bcu-good); border-color: var(--bcu-good); color: #fff; }
.bcu__btn--ghost { background: #fff; color: var(--bcu-ink); border-color: var(--bcu-line); }
.bcu__btn--ghost:hover { background: var(--bcu-wash); }

.bcu__dl { display: grid; }
.bcu__row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid rgba(6, 140, 134, .14); }
.bcu__row:first-child { border-top: 0; padding-top: 0; }
.bcu__row dt { font: 600 12.5px/1.5 var(--bcu-mono); color: var(--bcu-deep); overflow-wrap: anywhere; }
.bcu__row dd { min-width: 0; }
.bcu__val { display: block; font: 600 13.5px/1.5 var(--bcu-mono); color: var(--bcu-ink); overflow-wrap: anywhere; }
.bcu__row small { display: block; font-size: 12.5px; color: var(--bcu-muted); line-height: 1.35; }

.bcu__notes { display: grid; gap: 6px; }
.bcu .bcu__note {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 8px 10px 8px 30px; border-radius: 10px; background: #fff; border: 1px solid var(--bcu-line);
  font-size: 13.5px; line-height: 1.4; color: var(--bcu-ink2);
}
.bcu__note > span { flex: 1 1 220px; min-width: 0; }
.bcu__note::before {
  content: ""; position: absolute; left: 11px; top: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--bcu-muted);
}
.bcu__note--ok { border-color: rgba(14, 124, 85, .35); }
.bcu__note--ok::before { background: var(--bcu-good); }
.bcu__note--warn { border-color: #F0D49A; background: #FFFBF0; }
.bcu__note--warn::before { background: #E3A008; }
.bcu__note--err { border-color: #F2B8AE; background: #FFF6F4; color: #7A2414; }
.bcu__note--err::before { background: var(--bcu-bad); }
.bcu__note--info::before { background: var(--bcu-acc); }
.bcu__fix {
  height: 30px; padding: 0 11px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--bcu-ink); background: #fff; color: var(--bcu-ink); font-size: 13px; font-weight: 600;
}
.bcu__fix:hover { background: var(--bcu-ink); color: #fff; }

/* недавние ссылки */
.bcu__hd summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--bcu-ink2); }
.bcu__hl { display: grid; gap: 6px; margin-top: 8px !important; }
.bcu__hl li { display: flex; align-items: center; gap: 8px; }
.bcu__hu { flex: 1 1 auto; min-width: 0; font: 500 12px/1.4 var(--bcu-mono); color: var(--bcu-ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcu__hb, .bcu__hc {
  flex: 0 0 auto; height: 28px; padding: 0 9px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--bcu-line); background: #fff; font-size: 12.5px; font-weight: 600; color: var(--bcu-ink2);
}
.bcu__hb.is-done { background: var(--bcu-good); border-color: var(--bcu-good); color: #fff; }
.bcu__hc { margin-top: 8px; }

/* подвал */
.bcu__foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
  padding: 12px 20px; border-top: 1px solid var(--bcu-line); background: #fff; font-size: 13.5px; color: var(--bcu-muted);
}
.bcu a.bcu__more { font-size: 14px; font-weight: 600; color: var(--bcu-deep); text-decoration: none; }
.bcu a.bcu__more::after { content: " \2192"; }
.bcu a.bcu__more:hover { color: var(--bcu-ink); text-decoration: underline; }

/* страница инструмента: без рамки в рамке */
.bct-app.bct-app--flat { background: none; border: 0; padding: 0; box-shadow: none; }
.bct-app--flat > .bcu { margin: 0; }

/* узкий блок */
@container (max-width: 560px) {
  .bcu__head { padding: 14px; gap: 10px; }
  .bcu__top { padding: 12px 14px 0; }
  .bcu__plats { flex-wrap: nowrap; overflow-x: auto; margin-right: -14px; padding-right: 14px; scrollbar-width: none; }
  .bcu__plats::-webkit-scrollbar { display: none; }
  .bcu__plat { flex: 0 0 auto; }
  .bcu__form { grid-template-columns: minmax(0, 1fr); padding: 14px; gap: 12px; }
  .bcu__res { padding: 14px; }
  .bcu__foot { padding: 12px 14px; }
  .bcu__acts .bcu__btn { flex: 1 1 auto; }
  .bcu__mlist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .bcu__chip { width: 100%; }
  .bcu__chip--all { width: auto; justify-self: start; }
  .bcu__row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .bcu__xrow { grid-template-columns: minmax(0, 1fr) 40px; }
  .bcu__xrow .bcu__eq { display: none; }
  .bcu__xrow .bcu__ctl--k { grid-column: 1 / -1; }
}
@media (max-width: 460px) {
  .bcu { border-radius: 16px; margin: 24px 0; }
}
