/* Space above injected weather block */
:root {
    --agw-content-max: 1300px;
}

#em-he-home-widgets {
    margin-top: 24px;
}

.agw-widget {
    width: min(100%, var(--agw-content-max));
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
}

.agw-box {
    background: #233046;
    color: #ffffff;
    padding: 16px;
    border-radius: 12px;
    /*width: 100%;*/
    overflow: hidden;
    line-height: 1.5;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.agw-box h3,
.agw-box h4 {
    margin: 0 0 10px;
}

.agw-box p {
    margin: 6px 0;
}

.agw-provider-label {
    font-size: 12px;
    opacity: 0.78;
}

.agw-local-fallback .agw-provider-label {
    font-size: 13px !important;
    opacity: 0.82;
}

.agw-icon {
    display: inline-block;
    width: 1.4em;
}

.agw-moon-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Moon SVG is now inline — no disc/layer CSS needed */

/* Stacked : carte lune pleine largeur, SVG agrandi */
.agw-widget-layout-stacked .agw-moon-wrap {
    width: 100%;
}

.agw-widget-layout-stacked .agw-moon-wrap > svg {
    width: min(100%, 320px);
    height: auto;
    margin: 16px auto;
}

.agw-moon-percent {
    font-size: 24px;
    font-weight: 700;
}

.agw-moon-phase {
    opacity: 0.95;
    font-size: 16px;
}

.agw-moon-source {
    opacity: 0.78;
    font-size: 12px;
}

.agw-moon-all-phases {
    width: 100%;
    margin-top: 10px;
    text-align: left;
}

.agw-moon-all-phases h5 {
    margin: 0 0 8px;
    font-size: 14px;
    opacity: 0.92;
}

.agw-moon-all-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.agw-moon-mini-card {
    background: rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 8px 6px;
    text-align: center;
    min-width: 0;
    overflow: hidden;
}

.agw-moon-mini {
    width: 64px;
    height: 64px;
    margin: 2px auto 6px;
}


.agw-moon-mini-label {
    font-size: 10px;
    line-height: 1.25;
    opacity: 0.95;
    word-break: break-word;
}

.agw-calendar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.agw-day {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 8px;
}

.agw-day-label {
    font-weight: 700;
    margin-bottom: 4px;
}

.agw-day-icon {
    display: block;
    margin: 0 auto;
}

.agw-day-temp {
    font-size: 17px;
    font-weight: 700;
}

.agw-day-range {
    opacity: 0.9;
    font-size: 13px;
}

.agw-day-desc {
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.92;
}

.agw-widget-embed {
    padding: 0;
    overflow: hidden;
}

.agw-widget-embed-hidden {
    display: none;
}

.agw-widget-fallback[hidden] {
    display: none !important;
}

.agw-local-weather {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.agw-widget-has-fallback {
    width: 100%;
}

.agw-widget-fallback {
    width: 100%;
}

.agw-widget-fallback .agw-local-weather {
    width: 100%;
}

.agw-widget-fallback .agw-box {
    width: 100%;
}

.agw-local-fallback .agw-current {
    text-align: left;
    padding: 22px 24px;
}

.agw-local-fallback .agw-current h3 {
    font-size: 34px;
    line-height: 1.1;
    margin-bottom: 10px;
}

.agw-local-fallback .agw-current p {
    font-size: 20px;
    line-height: 1.25;
}

.agw-local-fallback .agw-forecast h4 {
    text-align: left;
    margin-bottom: 14px;
}

.agw-local-fallback .agw-day {
    min-height: 172px;
}

.agw-local-fallback .agw-day-temp {
    font-size: 28px;
    line-height: 1;
    margin: 4px 0;
}

.agw-local-fallback .agw-day-range {
    font-size: 18px;
}

.agw-local-fallback .agw-day-desc {
    font-size: 13px;
}

.agw-widget-embed iframe,
.agw-widget-embed .meteoblue-widget {
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
}

/* ===== TWO-COLUMNS ===== */
.agw-widget-layout-two-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 14px;
    align-items: start;
    width: 100%;
}

.agw-widget-layout-two-columns .agw-widget-embed {
    grid-column: 1 / 2;
    justify-self: start;
}

.agw-widget-layout-two-columns .agw-widget-fallback {
    grid-column: 1 / 2;
    justify-self: start;
    width: 100%;
}

.agw-widget-layout-two-columns .agw-moon-wrap {
    grid-column: 2 / 3;
    width: 100%;
    align-self: stretch;
    justify-self: stretch;
}

/* ===== ONE-LINE ===== */
.agw-widget-layout-one-line {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 14px;
    align-items: stretch;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
}

.agw-widget-layout-one-line .agw-widget-embed {
    flex: 1 0 420px;
}

.agw-widget-layout-one-line .agw-moon-wrap {
    flex: 0 0 220px; /* carte lune compacte dans la rangée */
}

/* ===== RESPONSIVE — 900px ===== */
@media (max-width: 900px) {

    /* two-columns → une colonne */
    .agw-widget-layout-two-columns {
        grid-template-columns: 1fr;
    }

    .agw-widget-layout-two-columns .agw-widget-embed,
    .agw-widget-layout-two-columns .agw-widget-fallback {
        grid-column: auto;
    }

    .agw-widget-layout-two-columns .agw-moon-wrap {
        grid-column: auto;
        width: 100%;
        justify-self: stretch;
    }

    .agw-widget-layout-two-columns .agw-moon-wrap > svg {
        width: min(100%, 320px);
        height: auto;
        margin: 16px auto;
    }

    /* one-line : réduire la base du widget embed */
    .agw-widget-layout-one-line .agw-widget-embed {
        flex-basis: 320px;
    }

    /* fallback meteo */
    .agw-local-fallback .agw-current h3 { font-size: 28px; }
    .agw-local-fallback .agw-current p  { font-size: 18px; }
    .agw-local-fallback .agw-calendar   { grid-template-columns: repeat(3, minmax(110px, 1fr)); }
    .agw-local-fallback .agw-day-temp   { font-size: 24px; }
    .agw-local-fallback .agw-day-range  { font-size: 15px; }

    .agw-moon-all-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ===== RESPONSIVE — 560px ===== */
@media (max-width: 560px) {

    /* one-line → wrap vertical */
    .agw-widget-layout-one-line {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .agw-widget-layout-one-line .agw-widget-embed {
        flex: 1 1 100%;
    }

    .agw-widget-layout-one-line .agw-moon-wrap {
        flex: 1 1 100%;
        width: 100%;
    }

    .agw-widget-layout-one-line .agw-moon-wrap > svg {
        width: min(100%, 280px);
        height: auto;
        margin: 16px auto;
    }

    .agw-moon-all-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .agw-local-fallback .agw-calendar { grid-template-columns: 1fr; }
}

