.forecast-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding: 6rem var(--side-padding);
}

.forecast-section h1 {
    grid-column: span 3;
}

.forecast-section .subtitle {
    grid-column: 3;
}

.iframe-container {
    grid-column: span 3;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    /* initial fallback before Shiny sends real height */
}

/* iframe and skeleton occupy the exact same box */
.forecast-skeleton {
    position: absolute;
    inset: 0;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    opacity: 0;

    transform: scale(1.01);
    filter: blur(2px);
    transition:
        opacity 320ms ease,
        transform 420ms ease,
        filter 420ms ease;
}

.iframe-container iframe.is-loaded {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

.forecast-skeleton {
    z-index: 2;
    padding: 0 0.6rem;

    opacity: 1;
    filter: blur(0);
    transition:
        opacity 220ms ease,
        transform 320ms ease,
        filter 320ms ease,
        visibility 0ms linear 320ms;
}

.forecast-skeleton.is-hidden {
    opacity: 0;
    filter: blur(3px);
    visibility: hidden;
    pointer-events: none;
}

.forecast-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 21rem 1fr;
    gap: 1.25rem;
    height: 100%;
}

.forecast-card {
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
}

.forecast-plot {
    grid-column: 1 / -1;
}

.sk-block {
    position: relative;
    background: rgba(0, 0, 0, 0.06);
}

.sk-block::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(250, 250, 250, 0.6),
            transparent);
    transform: translateX(-100%);
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

@media (max-width: 500px) {
    .iframe-container {
        min-height: 42rem;
        height: auto;
        /* better initial fallback on mobile */
    }

    .forecast-skeleton {
        padding: 0.5rem;
    }

    .forecast-skeleton-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 8rem 8rem 8rem 1fr;
        gap: 0.75rem;
    }

    .forecast-plot {
        min-height: 14rem;
    }
}

/* Contact cta section */
.frame2-text1,
.frame2-text2 {
    width: 28%;
    margin: 0;
}

.frame2-text2 {
    width: 32%;
}

.text-and-button {
    display: flex;
    padding-left: 1.5625rem;
    justify-content: center;
    align-items: center;
    gap: 0.625rem;
}

.highlight-demo {
    background-color: var(--green-color);
    color: var(--text-color);
    border-radius: 0.25rem;
    padding: 0.1rem 0.25rem;
}


/* Media Queries */
@media (prefers-reduced-motion: reduce) {

    .iframe-container iframe,
    .forecast-skeleton {
        transition: opacity 0.01ms linear;
        transform: none;
        filter: none;
    }

    .sk-block::after {
        animation: none;
    }
}

/* Small Devices (max-width: 400px) */
@media (max-width: 400px) {
    .forecast-section .subtitle {
        width: 70%;
    }

    .forecast-section h1 {
        gap: 1rem;
    }

    .forecast-section {
        padding: 3rem var(--side-padding);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .frame2-text1,
    .frame2-text2 {
        width: auto;
    }
}

/* Small-Medium Devices (400px - 767px) */
@media (min-width: 400px) and (max-width: 767px) {
    .forecast-section .subtitle {
        width: 70%;
    }

    .forecast-section h1 {
        gap: 1rem;
    }

    .forecast-section {
        padding: 3rem var(--side-padding);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .frame2-text1,
    .frame2-text2 {
        width: auto;
    }
}

/* Medium Devices (500px - 767px) */
@media (min-width: 500px) and (max-width: 767px) {}

/* Large Devices (768px - 1020px) */
@media (min-width: 768px) and (max-width: 1020px) {

    .forecast-section {
        padding: 5rem var(--side-padding);
    }

    .frame2-text1 {
        width: 38%;
    }
}

/* Extra Large Devices (1020px - 1500px) */
@media (min-width: 1020px) and (max-width: 1500px) {}

/* Extra Large Devices (1500px and up) */
@media (min-width: 1500px) {}

/* Ultra High Resolution (1920px and up) */
@media (min-width: 1920px) {
    .frame2 {
        max-height: 65rem;
    }

    .frame2-text1 {
        width: 20%;
    }
}