/* HTML-Embed-Modal — gescoped unter #embed-modal */
/* Z-Index 9110 (Plan-D-Schema: Pricing 9100 < Embed 9110 < Post-Publish 9120) */

#embed-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 10, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#embed-modal-overlay.open {
  display: flex;
  animation: emFadeIn 0.18s ease-out;
}

@keyframes emFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#embed-modal {
  background: var(--ui-surface, #1B1917);
  color: var(--ui-text, #F0EBE3);
  border: 1px solid var(--ui-border, rgba(244,239,232,0.12));
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 880px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  font-family: 'Inter Tight', sans-serif;
}
#embed-modal-overlay.open #embed-modal {
  animation: emSlideUp 0.22s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes emSlideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

[data-ui-theme="light"] #embed-modal {
  background: #ffffff;
  color: #1a1a1a;
  border-color: rgba(0, 0, 0, 0.12);
}

#embed-modal .em-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--ui-border, rgba(244,239,232,0.08));
}
[data-ui-theme="light"] #embed-modal .em-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

#embed-modal .em-title {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1;
  padding-right: 16px;
}

#embed-modal .em-title-card {
  font-style: italic;
  opacity: 0.7;
  font-weight: 400;
}

#embed-modal .em-close {
  background: transparent;
  border: 1px solid var(--ui-border, rgba(244,239,232,0.16));
  color: inherit;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  transition: all 0.18s ease;
  flex-shrink: 0;
}
#embed-modal .em-close:hover {
  background: rgba(244, 235, 220, 0.08);
  transform: scale(1.06);
}
[data-ui-theme="light"] #embed-modal .em-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

#embed-modal .em-body {
  padding: 20px 24px;
}

#embed-modal .em-section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.5;
  margin-bottom: 8px;
}

#embed-modal .em-snippet-wrap {
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--ui-border, rgba(244,239,232,0.10));
  border-radius: 8px;
  padding: 14px 16px;
  padding-right: 100px;
  margin-bottom: 18px;
}
[data-ui-theme="light"] #embed-modal .em-snippet-wrap {
  background: #f6f4f0;
  border-color: rgba(0, 0, 0, 0.08);
}

#embed-modal .em-snippet {
  font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  user-select: all;
}

#embed-modal .em-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--t-wine, #7A1F2E);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
#embed-modal .em-copy-btn:hover {
  background: var(--t-wine-dark, #5a1722);
  transform: translateY(-1px);
}
#embed-modal .em-copy-btn.copied {
  background: #4a7c4f;
}

#embed-modal .em-preview-wrap {
  border: 1px solid var(--ui-border, rgba(244,239,232,0.08));
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 18px;
  background: #fff;
}
[data-ui-theme="light"] #embed-modal .em-preview-wrap {
  border-color: rgba(0, 0, 0, 0.08);
}

#embed-modal .em-preview {
  width: 100%;
  height: 700px;
  border: none;
  display: block;
  background: #fff;
}

#embed-modal .em-help {
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.65;
  margin: 0;
}
#embed-modal .em-help code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 1px 5px;
  border-radius: 3px;
}
[data-ui-theme="light"] #embed-modal .em-help code {
  background: rgba(0, 0, 0, 0.06);
}

#embed-modal .em-error-state {
  text-align: center;
  padding: 24px 12px;
  font-size: 14px;
  opacity: 0.7;
}

@media (max-width: 540px) {
  #embed-modal-overlay { padding: 12px; }
  #embed-modal { max-height: calc(100vh - 24px); border-radius: 10px; }
  #embed-modal .em-header { padding: 16px 18px 12px; }
  #embed-modal .em-title { font-size: 18px; }
  #embed-modal .em-body { padding: 16px 18px; }
  #embed-modal .em-snippet-wrap { padding-right: 14px; padding-bottom: 50px; }
  #embed-modal .em-copy-btn { top: auto; bottom: 10px; right: 10px; }
  #embed-modal .em-preview { height: 320px; }
}
