/* tariff-modal — Figma component "Component" (node 238:234), 4 variants
   (Default/Variant2/Variant3/Variant4 = tariffs 1/3/6/12 months — Figma's
   own dev-mode label for Variant2 says "8 месяцев", but the site only
   ever sells 1/3/6/12 (matches section-pricing and the Public Offer's own
   "Тарифний план... на 1, 3, 6 або 12 місяців") — treated as a stray
   label in the Figma file, not a real 5th tariff, and corrected here.

   One <dialog> per tariff (tariff-modal-1m/3m/6m/12m in index.html)
   instead of one dialog with JS-swapped content — matches how
   section-pricing itself already writes out 4 near-identical cards by
   hand rather than templating them.

   The Figma frame also carries an empty, fully off-canvas "image
   63345998" layer (top:-638px, far above the 715px-tall card, clipped by
   the card's own overflow) — invisible in the actual render, so it's not
   reproduced here.

   Two separate pre-cropped exports for the cloud illustrations — "image
   63346000" (cherubs, top, behind the title) and "image 63345999" (plain
   clouds, bottom, behind the form) — both already at the card's own
   343px design width, so they're placed at their native aspect ratio
   (width:100%, height:auto) rather than cropped/stretched to a guessed
   box. .tariff-modal's own top/bottom padding is sized off each image's
   real height + a gap, so neither ever overlaps the title or the form
   below it regardless of viewport width. */

/* No `position` declared here on purpose — the UA stylesheet's own
   `dialog:modal { position: fixed; inset-block: 0; margin: auto; }` is
   what centers the dialog in the viewport on showModal(); overriding it
   to `relative` (tried first) put the dialog back in normal document
   flow instead, breaking that centering. `fixed` is still a valid
   containing block for this element's own `position: absolute`
   children (close button, clouds) below, so nothing else needs it. */
.tariff-modal {
  width: min(94vw, 343px);
  max-width: 343px;
  margin: auto;
  /* top: 193px image height + 24px gap; bottom: 125px image height +
     24px gap — clears both cloud images completely, measured off their
     actual exported pixel dimensions (both 343px wide, so this holds at
     any viewport since the images scale 1:1 with the card's own width). */
  padding: 217px 15px 149px;
  border: none;
  background: var(--color-cream-muted);
  overflow: hidden;
  color: var(--color-navy);
}

.tariff-modal[open] {
  display: block;
}

.tariff-modal::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.tariff-modal__clouds {
  position: absolute;
  left: 0;
  width: 100%;
  height: auto;
  pointer-events: none;
  z-index: 0;
}

.tariff-modal__clouds--top {
  top: 0;
}

.tariff-modal__clouds--bottom {
  bottom: 0;
}

.tariff-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* CSS-drawn × (same technique as .accordion-item__icon) — no icon asset
   needed for a plain two-line cross. */
.tariff-modal__close::before,
.tariff-modal__close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 1.5px;
  background: var(--color-navy);
  transform-origin: center;
}

.tariff-modal__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.tariff-modal__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.tariff-modal__close:hover::before,
.tariff-modal__close:hover::after,
.tariff-modal__close:focus-visible::before,
.tariff-modal__close:focus-visible::after {
  background: var(--color-dusty-blue);
}

.tariff-modal__title {
  position: relative;
  z-index: 1;
  margin: 0 0 32px;
  font-family: 'Kudryashev Display', serif;
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.34px;
  text-align: center;
  color: var(--color-navy);
}

.tariff-modal__form {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

/* ============ Name field — default / focus / error states ============
   No `pattern`/`inputmode` restriction on purpose: a legal name can
   contain letters in any script, spaces, hyphens, apostrophes — nothing
   here should ever block a keystroke. */
.tariff-modal__input {
  width: 100%;
  height: 61px;
  border: 1px solid var(--color-dusty-blue);
  border-radius: 999px;
  background: var(--color-cream-muted);
  padding: 0 24px;
  font-family: 'Jost', sans-serif;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.17px;
  color: var(--color-navy);
  transition: border-color 0.15s ease;
}

.tariff-modal__input::placeholder {
  color: rgba(22, 30, 57, 0.5);
}

.tariff-modal__input:focus-visible {
  outline: none;
  border-color: var(--color-navy);
}

/* Only after the user has actually left something in the field (or the
   form was submitted empty — js/tariff-modal.js adds this class then) —
   never on a pristine, untouched field, which :invalid alone would
   otherwise flag red before the visitor has done anything. */
.tariff-modal__input:invalid:not(:placeholder-shown),
.tariff-modal__input.tariff-modal__input--error {
  border-color: var(--color-maroon);
}

.tariff-modal__checks {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.tariff-modal__check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.tariff-modal__check input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.tariff-modal__check-box {
  position: relative;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border: 1px solid var(--color-dusty-blue);
  border-radius: 2px;
  background: var(--color-cream-muted);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tariff-modal__check-box::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--color-cream-muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  opacity: 0;
}

.tariff-modal__check input:checked ~ .tariff-modal__check-box {
  background: var(--color-dusty-blue);
  border-color: var(--color-dusty-blue);
}

.tariff-modal__check input:checked ~ .tariff-modal__check-box::after {
  opacity: 1;
}

.tariff-modal__check input:focus-visible ~ .tariff-modal__check-box {
  outline: 2px solid var(--color-navy);
  outline-offset: 2px;
}

.tariff-modal__check-text {
  flex: 1 0 0;
  min-width: 0;
  font-family: 'Jost', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.12px;
  color: rgba(22, 30, 57, 0.8);
}

.tariff-modal__check-text a {
  color: var(--color-navy);
}

.tariff-modal__submit {
  width: 100%;
}

/* Gated by js/tariff-modal.js: disabled until both consent checkboxes
   are checked — the Public Offer (п.1.3) requires that active tick
   before payment, not just reading the text. */
.tariff-modal__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tariff-modal__submit:disabled:hover {
  background-color: var(--color-dusty-blue);
}
