/* DIY studio modal — colors follow homepage tokens */
.diy-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: clamp(0.5rem, 2vw, 1.25rem);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s;
}

.diy-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.diy-modal__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(28, 25, 22, 0.2) 0%, var(--hero-overlay, rgba(28, 25, 22, 0.48)) 70%),
    rgba(42, 37, 32, 0.35);
  cursor: pointer;
}

.diy-modal__frame {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  width: min(100%, var(--container, 1800px));
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  border-radius: var(--radius, 12px);
  overflow: hidden;
  background: var(--bg, #ede8e1);
  box-shadow: var(--glass-shadow, 0 10px 32px rgba(28, 25, 22, 0.08)),
    0 24px 64px rgba(28, 25, 22, 0.22);
  border: 1px solid var(--glass-border-soft, rgba(28, 25, 22, 0.1));
}

.diy-modal__frame iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg, #ede8e1);
}

.diy-modal__loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  background: var(--bg, #ede8e1);
  color: var(--ink-soft, #5c564e);
  font-family: var(--font-ui, 'Poppins', system-ui, sans-serif);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.diy-modal__loading.is-visible {
  display: flex;
}

.diy-modal__spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(138, 106, 61, 0.2);
  border-top-color: var(--accent, #8a6a3d);
  animation: diy-spin 0.75s linear infinite;
}

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

.diy-modal__error {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  background: var(--bg-elevated, #f5f1eb);
  color: var(--ink, #1c1916);
  font-family: var(--font-ui, 'Poppins', system-ui, sans-serif);
  font-size: 0.9rem;
  line-height: 1.5;
}

.diy-modal__error.is-visible {
  display: flex;
}

.diy-modal__error a {
  color: var(--accent, #8a6a3d);
}

body.diy-modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .diy-modal {
    padding: 0;
  }

  .diy-modal__frame {
    border-radius: 0;
    border: none;
  }
}
