/* ==========================================================================
   Weather embed — 7-day forecast widget for blog iframes
   Self-contained: this page is loaded on its own inside an <iframe>.
   ========================================================================== */

:root {
    --wx-ink: #0f172a;
    --wx-muted: #64748b;
    --wx-line: #e5e9f2;
    --wx-brand: #0e7c66;
    --wx-brand-2: #16a37f;
    --wx-sun: #f5a524;
    --wx-rain: #3b82f6;
    --wx-snow: #7dd3fc;
    --wx-storm: #8b5cf6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.wx-embed {
    background: transparent;
    color: var(--wx-ink);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    padding: 4px;
}

.wx-widget {
    border: 1px solid var(--wx-line);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
    box-shadow: 0 10px 30px rgba(14, 36, 28, 0.06);
    overflow: hidden;
}

/* ---------- Header ---------- */
.wx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 13px 16px;
    border-bottom: 1px solid var(--wx-line);
    background: linear-gradient(135deg, rgba(14, 124, 102, 0.08) 0%, rgba(22, 163, 127, 0.05) 100%);
}

.wx-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.wx-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--wx-brand) 0%, var(--wx-brand-2) 100%);
    color: #fff;
    font-size: 19px;
    box-shadow: 0 8px 18px rgba(14, 124, 102, 0.25);
}

.wx-title {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.wx-subtitle {
    font-size: 12.5px;
    color: var(--wx-muted);
}

.wx-updated {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--wx-line);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--wx-muted);
    white-space: nowrap;
}

/* ---------- City tabs ---------- */
/* Equal-width tabs: sizing them by label length made the row look ragged
   ("Sighnaghi / Kakheti wine" dwarfing "Kutaisi / Imereti"). Wide enough for
   the row to fit, they share the width evenly; when it can't fit, they fall
   back to a fixed width and the row scrolls — still all the same size. */
.wx-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 8px;
    padding: 10px 14px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--wx-line);
}

.wx-tabs::-webkit-scrollbar {
    display: none;
}

.wx-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--wx-line);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.wx-tab-name,
.wx-tab-region {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wx-tab-name {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.2;
}

.wx-tab-region {
    font-size: 10.5px;
    color: var(--wx-muted);
}

/* Not enough room for eight equal columns — scroll them instead of squeezing */
@media (max-width: 900px) {
    .wx-tabs {
        grid-auto-columns: 124px;
    }
}

.wx-tab:hover {
    border-color: rgba(14, 124, 102, 0.45);
    transform: translateY(-1px);
}

.wx-tab.is-active {
    background: linear-gradient(135deg, var(--wx-brand) 0%, var(--wx-brand-2) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 18px rgba(14, 124, 102, 0.28);
}

.wx-tab.is-active .wx-tab-region {
    color: rgba(255, 255, 255, 0.82);
}

/* ---------- Panels ---------- */
.wx-panel {
    display: none;
    padding: 14px 16px 4px;
}

.wx-panel.is-active {
    display: block;
}

/* Today hero */
.wx-today {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eef6f3 0%, #f7fbfa 100%);
    border: 1px solid var(--wx-line);
}

.wx-today-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.wx-today-icon {
    font-size: 40px;
    color: var(--wx-brand);
}

.wx-today-temp {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.wx-today-min {
    font-size: 17px;
    font-weight: 600;
    color: var(--wx-muted);
    margin-left: 4px;
}

.wx-today-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--wx-muted);
    margin-top: 3px;
}

.wx-today-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    list-style: none;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
}

.wx-today-meta i {
    color: var(--wx-brand);
    margin-right: 4px;
}

/* Weather-kind tinting for the hero icon */
.wx-kind-clear { color: var(--wx-sun); }
.wx-kind-partly { color: var(--wx-sun); }
.wx-kind-rain { color: var(--wx-rain); }
.wx-kind-snow { color: var(--wx-snow); }
.wx-kind-storm { color: var(--wx-storm); }
.wx-kind-fog,
.wx-kind-cloudy { color: #94a3b8; }

/* ---------- 7-day strip ----------
   Seven columns side by side rather than seven stacked rows: the rows left a
   wide empty gutter in the middle of the card and pushed the widget tall. */
.wx-days {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.wx-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 12px 6px 11px;
    border-radius: 13px;
    border: 1px solid var(--wx-line);
    background: #fff;
    text-align: center;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.wx-day:hover {
    background: #f4faf8;
    border-color: rgba(14, 124, 102, 0.32);
    transform: translateY(-2px);
}

.wx-day.is-today {
    background: linear-gradient(180deg, rgba(14, 124, 102, 0.10) 0%, rgba(22, 163, 127, 0.05) 100%);
    border-color: rgba(14, 124, 102, 0.34);
    box-shadow: 0 6px 16px rgba(14, 124, 102, 0.12);
}

.wx-day-name {
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.wx-day-date {
    font-size: 11px;
    color: var(--wx-muted);
    font-weight: 600;
}

.wx-day-icon {
    font-size: 22px;
    margin: 3px 0 1px;
}

.wx-day-temps {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
}

.wx-day-temps strong {
    font-weight: 800;
}

.wx-day-temps span {
    color: var(--wx-muted);
    font-weight: 600;
    font-size: 12.5px;
}

.wx-day-rain {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--wx-muted);
}

.wx-day-rain.is-wet {
    color: var(--wx-rain);
}

/* Narrow embeds: keep the cards readable and let the strip scroll */
/* Tablet width: still one row, just narrower cards that may scroll */
@media (min-width: 561px) and (max-width: 700px) {
    .wx-days {
        grid-template-columns: repeat(7, 96px);
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .wx-days::-webkit-scrollbar {
        display: none;
    }
}

/* ---------- Footer ---------- */
.wx-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 16px 11px;
    border-top: 1px solid var(--wx-line);
    margin-top: 10px;
    font-size: 11.5px;
    color: var(--wx-muted);
}

.wx-footer a {
    color: var(--wx-brand);
    font-weight: 700;
    text-decoration: none;
}

.wx-footer a:hover {
    text-decoration: underline;
}

.wx-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--wx-brand) 0%, var(--wx-brand-2) 100%);
    color: #fff !important;
    font-size: 12px;
    text-decoration: none;
}

.wx-cta:hover {
    text-decoration: none !important;
    opacity: 0.94;
}

.wx-error {
    padding: 28px 18px;
    text-align: center;
    color: var(--wx-muted);
    font-size: 14px;
}

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
    body.wx-embed {
        font-size: 14px;
    }

    .wx-header {
        padding: 13px 14px;
    }

    .wx-title {
        font-size: 15.5px;
    }

    .wx-subtitle {
        font-size: 11.5px;
    }

    .wx-brand-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .wx-panel {
        padding: 13px 13px 4px;
    }

    .wx-today {
        padding: 13px 14px;
    }

    .wx-today-icon {
        font-size: 32px;
    }

    .wx-today-temp {
        font-size: 28px;
    }

    /* Phones: nothing scrolls sideways. The eight cities wrap onto three rows
       and the seven days stack — the whole widget is visible in one piece,
       which is what a reader scrolling an article expects. */
    .wx-tabs {
        grid-auto-flow: row;
        grid-template-columns: repeat(3, 1fr);
        grid-auto-columns: auto;
        overflow-x: visible;
        gap: 6px;
        padding: 10px 12px;
    }

    .wx-tab {
        padding: 7px 6px;
    }

    .wx-tab-name {
        font-size: 12.5px;
    }

    .wx-tab-region {
        font-size: 9.5px;
    }

    /* Day cards become rows again: name+date | icon | temps | rain */
    .wx-days {
        grid-template-columns: 1fr;
        overflow-x: visible;
        gap: 5px;
    }

    .wx-day {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        padding: 9px 12px;
        border-radius: 11px;
        text-align: left;
    }

    .wx-day-name {
        flex: 0 0 42px;
        font-size: 12.5px;
    }

    .wx-day-date {
        flex: 0 0 48px;
        font-size: 11px;
    }

    .wx-day-icon {
        flex: 0 0 22px;
        margin: 0;
        font-size: 18px;
        text-align: center;
    }

    .wx-day-temps {
        flex: 1 1 auto;
        justify-content: flex-start;
        gap: 6px;
        font-size: 13.5px;
    }

    .wx-day-rain {
        flex: 0 0 46px;
        justify-content: flex-end;
        font-size: 11.5px;
    }
}
