html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}
img { min-height: 1px; }

/* Tiptap Placeholder styling */
.tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #adb5bd;
  pointer-events: none;
  height: 0;
}

/* Fix for dangerouslySetInnerHTML images and Table of Contents */
.editorial-content img {
  cursor: zoom-in;
}

.editorial-content h2, .editorial-content h3 {
  scroll-margin-top: 5rem;
}

/* Image alignment, wrapper, and figure styling */
.image-wrapper {
  box-sizing: border-box;
  display: block;
}

.align-left, .float-left, .image-align-left, .image-figure.align-left, .image-wrapper.align-left {
  float: left !important;
  margin: 0 1.5rem 1rem 0 !important;
  max-width: 50%;
}

.align-right, .float-right, .image-align-right, .image-figure.align-right, .image-wrapper.align-right {
  float: right !important;
  margin: 0 0 1rem 1.5rem !important;
  max-width: 50%;
}

.align-center, .image-align-center, .image-figure.align-center, .image-wrapper.align-center {
  display: block !important;
  margin: 0 auto 1.5rem auto !important;
  text-align: center !important;
  float: none !important;
}

/* Figure and Caption styling */
.image-caption, .image-figure figcaption, figure figcaption {
  font-style: italic !important;
  font-size: 0.875rem !important; /* text-sm */
  color: #64748b !important; /* slate-500 */
  margin-top: 0.5rem !important;
  line-height: 1.25rem !important;
  text-align: center !important;
}

/* Ensure images don't exceed container width and apply max-height */
.prose img, .prose figure img, .editorial-content img, .editorial-content figure img {
  max-width: 100%;
  height: auto;
}

/* Clearfix for containers with floated elements */
.editorial-content::after, .prose::after, .clearfix::after {
  content: "";
  clear: both;
  display: table;
}

/* Specific Tiptap editor fixes */
.tiptap .ProseMirror-selectednode {
  outline: 3px solid #2dd4bf;
}

/* Mobile responsiveness for floated images */
@media (max-width: 640px) {
  .align-left, .float-left, .image-align-left, .image-figure.align-left, .image-wrapper.align-left,
  .align-right, .float-right, .image-align-right, .image-figure.align-right, .image-wrapper.align-right {
    float: none !important;
    margin: 0 auto 1rem auto !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* PC Image constraints for editorial content */
@media (min-width: 1024px) {
  .editorial-content img,
  .prose img,
  .editorial-content figure img,
  .prose figure img {
    max-height: 80vh !important;
    max-width: 100% !important;
    object-fit: contain !important;
    width: auto !important;
    margin-left: auto;
    margin-right: auto;
  }
}
