*,
::before,
::after {
  box-sizing: border-box;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif, Apple Color Emoji, "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

/* Apply this body styling ONLY to the standalone newsletter preview */
body.newsletter-standalone-preview {
  min-height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  padding: 10px;
  display: grid;
  gap: 3vw;
  grid-template-rows: min-content 1fr min-content;
  font-size: 1.2rem;
  background: #fcfcfc;
  color: #333;
}

a {
  color: currentColor;
}

/* Existing styles in newsletter.css */
.responsive-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
}

/* Styles for the main content wrapper - you might already have something similar */
.newsletter-page-content {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    color: #333;
    line-height: 1.6;
}

/* Styles for the header image container and overlay headline */
.newsletter-header-image-container {
    margin-bottom: 30px;
    position: relative;
    text-align: center;
}

.newsletter-header-image-container img {
    width: 100%;
    /* max-width is set by the {% image %} tag's width parameter */
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 4px;
}

.newsletter-headline-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* color is set inline from page.headline_color */
    font-size: 2.5em; /* Default for larger screens */
    font-weight: bold; /* Added for consistency with h1 */
    margin: 0;
    padding: 10px 20px;
    width: 90%; /* Ensure text doesn't overflow too much */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7); /* For readability */
    line-height: 1.2;
    box-sizing: border-box; /* Include padding in width calculation */
}

/* Styles for the main page title (if not an overlay) */
.newsletter-main-title {
    font-size: 2.5em; /* Default for larger screens */
    margin-bottom: 10px;
    color: #111;
    font-weight: bold; /* Added for consistency */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 767px) { /* Adjust breakpoint as needed, e.g., 600px */
    .newsletter-headline-overlay {
        font-size: 1.8em; /* Smaller font size for mobile */
        padding: 5px 10px;
        width: 95%; /* Allow a bit more width relative to smaller screen */
    }

    .newsletter-main-title {
        font-size: 1.8em; /* Smaller font size for mobile */
    }

    .newsletter-page-content {
        margin: 15px auto;
        padding: 0 10px;
    }
    .newsletter-body-content {
        font-size: 1em; /* Slightly smaller body font on mobile */
    }
}

@media (max-width: 480px) { /* Even smaller screens */
    .newsletter-headline-overlay {
        font-size: 1.5em; /* Even smaller */
        line-height: 1.3;
    }

    .newsletter-main-title {
        font-size: 1.5em; /* Even smaller */
    }
}

/* Add this to your existing CSS file */
.newsletter-body-content img {
    max-width: 100%; /* Ensures the image never overflows its container */
    height: auto;    /* Maintains the aspect ratio */
    display: block;  /* Optional: can help with spacing issues */
    margin-left: auto; /* Optional: centers block-level images if container is wider */
    margin-right: auto;/* Optional: centers block-level images if container is wider */
}