/* ----- GLOBAL STYLE MODAL ----- */
body.modal-open {
  overflow: hidden;
}
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
  overscroll-behavior: none;
  padding: 20px;
}
.modal.hidden {
  display: none;
}
.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(8px);
}
.modal__content {
  position: relative;
  z-index: 1;
  color: var(--modal-text);
  padding: 30px;
  border-radius: 0;
  /* Под стеклом плотная подложка: на однотонном фоне иначе просвечивает текст страницы */
  background-color: var(--modal-surface);
  width: min(90%, 500px);
  animation: fadeSlide 0.3s ease;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal__close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #111;
  background: var(--c-accent);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.modal__close:hover {
  color: var(--c-accent);
  background: #111;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ----- MODAL CONTACT ----- */
#contact-modal .modal__content {
  width: min(92%, 520px);
  padding: clamp(24px, 3vw, 36px);
}
#contact-modal .about-label {
  color: var(--modal-text);
}
#contact-modal h2 {
  padding-right: 40px;
  margin: 8px 0 20px;
  font-family: var(--font-display-family);
  font-size: clamp(34px, 3.4vw, 52px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--modal-text);
}
#contact-modal .form-group label {
  font-family: var(--font-mono-family);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--modal-text);
}
#contact-modal input,
#contact-modal textarea {
  width: 100%;
  margin-bottom: 6px;
  padding: 12px 14px;
  border: none;
  border-radius: 0;
  font-family: var(--font-mono-family);
  font-size: 15px;
  color: var(--modal-text);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--ab-line);
  transition: box-shadow 0.2s ease;
}
#contact-modal input::placeholder,
#contact-modal textarea::placeholder {
  color: var(--ab-ink-soft);
  opacity: 0.7;
}
#contact-modal input:hover,
#contact-modal textarea:hover {
  box-shadow: inset 0 0 0 1px var(--ab-ink-soft);
}
#contact-modal input:focus,
#contact-modal textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--modal-input-focus);
}
#contact-modal textarea {
  resize: vertical;
  min-height: clamp(100px, 18vh, 180px);
  max-width: 100%;
  box-sizing: border-box;
}
#contact-modal .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
#contact-modal .btn {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 18px 0 0;
}
#contact-modal .errorlist {
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono-family);
  font-size: 12px;
  line-height: 1.3;
  color: var(--modal-error-color);
}

/* ----- CHECKBOX CONSENT ----- */
#contact-modal .form-checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
#contact-modal .form-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  padding: 0;
  box-shadow: inset 0 0 0 1px var(--ab-ink-soft);
  cursor: pointer;
}
#contact-modal .form-checkbox input[type="checkbox"]:checked {
  box-shadow: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='3' stroke-linecap='square'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 70% no-repeat,
    var(--c-accent);
}
#contact-modal .form-checkbox label {
  margin: 0;
  font-family: var(--font-body-family);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--modal-text);
  cursor: pointer;
  user-select: none;
}
#contact-modal .form-checkbox label a {
  color: var(--c-accent);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}
#contact-modal .form-checkbox label a:hover {
  opacity: 0.8;
  text-decoration: none;
}
#contact-modal .form-checkbox .errorlist {
  width: 100%;
  margin-top: 4px;
  margin-bottom: 0;
  padding-left: 26px;
  list-style: none;
}
#contact-modal .form-checkbox input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--modal-input-focus);
  outline-offset: 2px;
}


/* ----- MODAL SERVICES ----- */
#service-detail-modal .modal__content {
  display: flex;
  flex-direction: column;
  width: 92%;
  max-width: 820px;
  max-height: 90vh;
  height: auto;
  padding: 0;
}
#service-detail-modal .service-detail {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
#service-detail-modal .service-detail__image {
  width: 100%;
  max-height: clamp(120px, 26vh, 280px);
  object-fit: cover;
  border-radius: 0;
}
#service-detail-modal .service-detail__title {
  margin: 0;
  padding: clamp(18px, 2.4vw, 30px) clamp(20px, 3vw, 36px) 12px;
  font-family: var(--font-display-family);
  font-size: clamp(30px, 3.4vw, 56px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--modal-text);
}
#service-detail-modal .service-detail__desc {
  flex: 1;
  min-height: 0;
  margin: 0 clamp(20px, 3vw, 36px);
  padding-right: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: clamp(15px, 1.1vw, 18px);
  line-height: 1.65;
  color: var(--modal-text);
}
#service-detail-modal .service-detail__desc :is(h1, h2, h3, h4) {
  margin: 1.1em 0 0.4em;
}
#service-detail-modal .service-detail__desc > :first-child {
  margin-top: 0;
}
#service-detail-modal .service-detail__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-shrink: 0;
  margin-top: 16px;
  padding: 16px clamp(20px, 3vw, 36px) clamp(18px, 2.4vw, 28px);
  border-top: 1px solid var(--ab-line);
}
#service-detail-modal .service-detail__price {
  margin: 0;
  font-family: var(--font-display-family);
  font-size: clamp(28px, 2.6vw, 42px);
  font-weight: 700;
  line-height: 1;
  color: var(--c-accent);
}
#service-detail-modal .service-detail__price:empty {
  display: none;
}
#service-detail-modal .service-detail__order {
  margin: 0 0 0 auto;
}
/* Стек в модалке не показываем */
.service-detail__skill {
  display: none !important;
}
.service-detail__skill-label {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--modal-title);
}


/* ----- IMAGES MODAL ----- */
.image-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 10, 0.94);
  justify-content: center;
  align-items: center;
  padding: 64px 80px;
  touch-action: pan-y;
}
.image-modal.active {
  display: flex;
}
.image-modal__content {
  max-width: 100%;
  max-height: 84vh;
  object-fit: contain;
  user-select: none;
}
.image-modal__close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: none;
  font-size: 34px;
  line-height: 1;
  color: #111;
  background: var(--c-accent);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.image-modal__close:hover {
  color: var(--c-accent);
  background: #ededed;
}
.image-modal__nav {
  width: 52px;
  height: 52px;
  color: #ededed;
  background: rgba(237, 237, 237, 0.08);
  box-shadow: inset 0 0 0 1px rgba(237, 237, 237, 0.25);
}
.image-modal__nav--prev {
  left: 16px;
}
.image-modal__nav--next {
  right: 16px;
}
.image-modal.is-single .image-modal__nav,
.image-modal.is-single .image-modal__counter {
  display: none;
}
.image-modal__counter {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0 18px;
  height: 56px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono-family);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #ededed;
  background: rgba(237, 237, 237, 0.08);
}
