#if MC_VERSION >= 11300
    // The previous clear-weather threshold reached 0.55 before its dynamic
    // multiplier. Since the natural cloud texture is centered near 0.5, that
    // discarded most of both rotated samples and left an almost empty sky.
    umbral = (smoothstep(1.0, 0.0, rainStrength) * 0.24) + 0.20;
#else
    umbral = (smoothstep(1.0, 0.0, rainStrength) * 0.24) + 0.36;
#endif

#if COLOR_SCHEME == 12
    umbral *= 0.75;
#endif

umbral *= CLOUD_DENSITY;
// Restore the sparse night silhouette: only a few cloud formations survive
// the threshold, leaving the aurora as the dominant feature of the night sky.
umbral *= day_blend_float(1.0, 1.0, 1.20);

bool check = (lightningBoltPosition.w > 0.001);
float lightning = float(check);

vec3 antiRed = day_blend(vec3(1.0), vec3(0.0, 1.5, 1.0), vec3(1.0)); // Avoid red color in transition during tick 0 to ~3000

#if CLOUD_VOL_STYLE == 0
    dark_cloud_color = day_blend(
        ZENITH_SUNSET_COLOR,
        saturate(ZENITH_DAY_COLOR, 2.0) * 0.8,
        ZENITH_NIGHT_COLOR
    );
    
    vec3 cloud_color_aux = mix(
        day_blend(
            saturate(LIGHT_SUNSET_COLOR, 0.5) * day_blend_float(0.5, 0.5, 0.25),
            LIGHT_DAY_COLOR * 0.9,
            LIGHT_NIGHT_COLOR * 1.333
        ),
        ZENITH_SKY_RAIN_COLOR * day_blend_float(1.0, 0.75, 1.0) * saturate(dark_cloud_color, 0.2),
        rainStrength
    );
#else
    dark_cloud_color = day_blend(
        ZENITH_SUNSET_COLOR * 0.5,
        #if COLOR_SCHEME == 11
            ZENITH_DAY_COLOR * 0.5,
        #else
            ZENITH_DAY_COLOR * 1.5,
        #endif
        ZENITH_NIGHT_COLOR * 0.5
    );
    
    vec3 cloud_color_aux = mix(
        day_blend(
            saturate(LIGHT_SUNSET_COLOR, 0.5) * day_blend_float(0.6, 0.5, 0.15),
            LIGHT_DAY_COLOR * 0.9,
            saturate(LIGHT_NIGHT_COLOR, 0.5) * 1.5
        ),
        ZENITH_SKY_RAIN_COLOR * saturate(dark_cloud_color, 0.2) * day_blend_float(1.0, 0.5, 3.0),
        rainStrength
    );
#endif

dark_cloud_color = mix(
    dark_cloud_color,
    ZENITH_SKY_RAIN_COLOR * color_average(dark_cloud_color * day_blend_float(1.1, 0.5, 1.25)),
    rainStrength
);

cloud_color = mix(
    clamp(mix(v3_luma(cloud_color_aux), cloud_color_aux, 0.5) * vec3(1.5), 0.0, 1.4),
    day_blend(
        (MID_SUNSET_COLOR + HORIZON_SUNSET_COLOR) * day_blend_float(0.333, 0.333, 0.1) * antiRed,
        HORIZON_DAY_COLOR,
        HORIZON_NIGHT_COLOR
    ),
    0.3
);

cloud_color = mix(cloud_color, (HORIZON_SKY_RAIN_COLOR + (HORIZON_SKY_RAIN_COLOR * lightning)) * luma(cloud_color_aux) * 12.0, rainStrength);

#if COLOR_SCHEME == 13
    // Rift-cataclysm illumination during rainy nights. The cloud mass remains
    // dark while its diffuse top light alternates between cyan and violet,
    // suggesting unstable energy behind the storm rather than a flat sky tint.
    float cloudRainEnvelope = smoothstep(0.015, 0.985,
        clamp(rainStrength, 0.0, 1.0));
    cloudRainEnvelope = cloudRainEnvelope * cloudRainEnvelope
        * (3.0 - 2.0 * cloudRainEnvelope);
    float cloudCataclysm = day_blend_float(0.0, 0.0, 1.0)
        * cloudRainEnvelope;
    float cloudDischarge = 0.5 + 0.5 * sin(
        frameTimeCounter * 0.83 + 4.7);
    cloudDischarge *= 0.72 + 0.28 * sin(
        frameTimeCounter * 0.31 + 2.1);
    vec3 cataclysmCloudLight = mix(
        vec3(0.055, 0.145, 0.34),
        vec3(0.24, 0.070, 0.31),
        cloudDischarge);
    dark_cloud_color = mix(
        dark_cloud_color,
        dark_cloud_color * vec3(0.74, 0.82, 1.04)
            + cataclysmCloudLight * 0.20,
        cloudCataclysm * 0.58);
    cloud_color += cataclysmCloudLight
        * cloudCataclysm * (0.16 + cloudDischarge * 0.16);
#endif

#if CLOUD_VOL_STYLE == 0
    dark_cloud_color = mix(dark_cloud_color, cloud_color, clamp(0.2 / (CLOUD_DENSITY), -1.0, 0.5));
#else
    dark_cloud_color = mix(dark_cloud_color, cloud_color, 0.3);
#endif

dark_cloud_color = mix(
    dark_cloud_color,
    day_blend(
        cloud_color_aux,
        dark_cloud_color,
        dark_cloud_color
    ),
    0.4
);

// Dense night clouds still receive diffuse moon/sky irradiance. Lifting only
// values below this floor preserves their internal density texture and avoids
// the crushed-black patches produced by the very dark zenith palette.
float night_cloud_amount = day_blend_float(0.0, 0.0, 1.0);
// Overcast nights scatter moon/sky light instead of crushing cloud detail.
#if COLOR_SCHEME == 13
    vec3 moon_cloud_floor = vec3(0.038, 0.068, 0.126)
        * mix(1.0, 1.10, rainStrength);
#else
    vec3 moon_cloud_floor = vec3(0.048, 0.078, 0.118)
        * mix(1.0, 1.10, rainStrength);
#endif
float dark_cloud_luma = luma(dark_cloud_color);
float dark_recovery = night_cloud_amount
    * (1.0 - smoothstep(0.018, 0.075, dark_cloud_luma));
dark_cloud_color = mix(
    dark_cloud_color, moon_cloud_floor, dark_recovery * 0.80);

float lit_cloud_luma = luma(cloud_color);
float lit_recovery = night_cloud_amount
    * (1.0 - smoothstep(0.035, 0.12, lit_cloud_luma));
cloud_color = mix(
    cloud_color, moon_cloud_floor * vec3(1.22, 1.16, 1.28),
    lit_recovery * 0.56);

#if COLOR_SCHEME == 11
    cloud_color *= mix(1.75, 1.5, rainStrength);
    dark_cloud_color *= mix(1.75, 1.5, rainStrength);
#endif
