/* Собственная типографика: размер данных не зависит от мелкого шрифта темы. */
.papex-meteopulse {
    --papex-bg: #ffffff;
    --papex-surface: #f5f7fa;
    --papex-card-bg: #ffffff;
    --papex-text: #1f2937;
    --papex-muted: #475569;
    --papex-border: rgba(100, 116, 139, 0.22);
    --papex-divider: rgba(100, 116, 139, 0.18);
    --papex-shadow: rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--papex-border);
    border-radius: 16px;
    background: var(--papex-bg);
    color: var(--papex-text);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    box-shadow: 0 8px 30px var(--papex-shadow);
    display: block;
    max-width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
    flex: 0 0 auto;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

/* Сохраняем автоматическую смену палитры по фону окружающего контейнера. */
.papex-meteopulse--dark {
    --papex-bg: #171b21;
    --papex-surface: #202630;
    --papex-card-bg: #282f39;
    --papex-text: #f1f5f9;
    --papex-muted: #c3cedb;
    --papex-border: rgba(226, 232, 240, 0.20);
    --papex-divider: rgba(226, 232, 240, 0.16);
    --papex-shadow: rgba(0, 0, 0, 0.22);
}

/* Включаем отступы и границы в расчёт размеров дочерних элементов. */
.papex-meteopulse *, .papex-meteopulse *::before, .papex-meteopulse *::after {
    box-sizing: border-box;
}

/* Уменьшаем внутренние отступы в узких колонках. */
.papex-meteopulse--narrow { padding: 14px; border-radius: 13px; }
.papex-meteopulse--compact { padding: 12px; border-radius: 12px; }

/* Базовая верстка рассчитана даже на самые узкие боковые колонки. */
.papex-meteopulse .papex-meteopulse__current {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 8px 14px;
}
.papex-meteopulse .papex-meteopulse__heading { display: contents; }
.papex-meteopulse .papex-meteopulse__place {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    color: var(--papex-text);
    font-size: 25px;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.papex-meteopulse .papex-meteopulse__condition {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.papex-meteopulse .papex-meteopulse__current-icon {
    display: block;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    object-fit: contain;
}
.papex-meteopulse .papex-meteopulse__description {
    min-width: 0;
    color: var(--papex-text);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.papex-meteopulse .papex-meteopulse__temperature {
    grid-column: 1;
    grid-row: 2;
    color: var(--papex-text);
    font-size: 52px;
    font-weight: 750;
    line-height: 1.05;
    letter-spacing: -0.035em;
    white-space: nowrap;
}

/* Значения выделены размером и весом; подписи контрастны и не уменьшаются на телефонах. */
.papex-meteopulse .papex-meteopulse__facts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px 14px;
    margin-top: 16px;
    padding-top: 15px;
    border-top: 1px solid var(--papex-divider);
}
.papex-meteopulse .papex-meteopulse__fact {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.papex-meteopulse .papex-meteopulse__fact-icon {
    display: block;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    object-fit: contain;
}
/* Осветляем монохромные значки в тёмной теме и сохраняем цвета солнечных. */
.papex-meteopulse--dark .papex-meteopulse__fact-icon {
    filter: brightness(0) invert(1);
    opacity: 0.84;
}
.papex-meteopulse--dark .papex-meteopulse__fact-icon--solar {
    filter: none;
    opacity: 1;
}
.papex-meteopulse .papex-meteopulse__fact > div { min-width: 0; }
.papex-meteopulse .papex-meteopulse__fact-label,
.papex-meteopulse .papex-meteopulse__fact strong { display: block; }
.papex-meteopulse .papex-meteopulse__fact-label {
    margin-bottom: 3px;
    color: var(--papex-muted);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.papex-meteopulse .papex-meteopulse__fact strong {
    color: var(--papex-text);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}

.papex-meteopulse .papex-meteopulse__moon-text {
    min-width: 0;
}
.papex-meteopulse .papex-meteopulse__fact--moon strong {
    display: block;
    color: var(--papex-text);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Почасовая лента: компактнее по высоте, крупнее по тексту; прокрутка только внутри ленты. */
.papex-meteopulse .papex-meteopulse__hourly {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min(150px, 100%);
    min-width: 0;
    gap: 8px;
    margin-top: 16px;
    padding: 8px;
    overflow-x: auto;
    border-radius: 12px;
    background: var(--papex-surface);
    scrollbar-width: thin;
    scrollbar-color: var(--papex-muted) transparent;
    overscroll-behavior-inline: contain;
}
.papex-meteopulse .papex-meteopulse__hour {
    min-width: 0;
    padding: 9px 7px;
    border: 1px solid var(--papex-border);
    border-radius: 10px;
    background: var(--papex-card-bg);
    text-align: center;
}
.papex-meteopulse .papex-meteopulse__hour time,
.papex-meteopulse .papex-meteopulse__hour-temperature,
.papex-meteopulse .papex-meteopulse__rain { display: block; }
.papex-meteopulse .papex-meteopulse__hour time {
    margin: 0 0 4px;
    color: var(--papex-muted);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
}
.papex-meteopulse .papex-meteopulse__hour-temperature {
    margin: 0 0 4px;
    color: var(--papex-text);
    font-size: 25px;
    font-weight: 700;
    line-height: 1.12;
}
.papex-meteopulse .papex-meteopulse__hour-condition {
    display: grid;
    grid-template-rows: 44px auto;
    justify-items: center;
    align-items: start;
    gap: 3px;
    width: 100%;
}
.papex-meteopulse .papex-meteopulse__hour-icon {
    display: block;
    width: 44px;
    height: 44px;
    object-fit: contain;
}
.papex-meteopulse .papex-meteopulse__hour-description {
    display: block;
    width: 100%;
    min-width: 0;
    color: var(--papex-text);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: none;
}
.papex-meteopulse .papex-meteopulse__rain {
    margin-top: 5px;
    color: var(--papex-muted);
    font-size: 14px;
    line-height: 1.25;
}
/* Подпись и ссылка на поставщика прогноза. */
.papex-meteopulse .papex-meteopulse__source {
    margin-top: 10px;
    color: var(--papex-muted);
    text-align: right;
    font-size: 13px;
    line-height: 1.3;
}
.papex-meteopulse .papex-meteopulse__source a {
    color: var(--papex-muted);
    font-size: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
/* Сообщение о проблеме с прогнозом для администратора. */
.papex-meteopulse-error {
    padding: 10px 12px;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 6px;
}
/* Полоса горизонтальной прокрутки прогноза. */
.papex-meteopulse__hourly::-webkit-scrollbar { height: 7px; }
.papex-meteopulse__hourly::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--papex-muted);
}

/* Адаптация по ширине содержимого через ResizeObserver, без CSS containment. */

.papex-meteopulse.papex-meteopulse--layout-320 .papex-meteopulse__current { grid-template-columns: minmax(0, 1fr) auto; }
.papex-meteopulse.papex-meteopulse--layout-320 .papex-meteopulse__condition { grid-column: 1; grid-row: 2; }
.papex-meteopulse.papex-meteopulse--layout-320 .papex-meteopulse__temperature { grid-column: 2; grid-row: 2; text-align: right; }
.papex-meteopulse.papex-meteopulse--layout-320 .papex-meteopulse__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.papex-meteopulse.papex-meteopulse--layout-540 .papex-meteopulse__place { font-size: 30px; }
.papex-meteopulse.papex-meteopulse--layout-540 .papex-meteopulse__description { font-size: 24px; }
.papex-meteopulse.papex-meteopulse--layout-540 .papex-meteopulse__current-icon { width: 58px; height: 58px; flex-basis: 58px; }
.papex-meteopulse.papex-meteopulse--layout-540 .papex-meteopulse__temperature { font-size: 66px; }
.papex-meteopulse.papex-meteopulse--layout-540 .papex-meteopulse__facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.papex-meteopulse.papex-meteopulse--layout-540 .papex-meteopulse__hourly { grid-auto-columns: minmax(154px, 1fr); }
.papex-meteopulse.papex-meteopulse--layout-540 .papex-meteopulse__hour { padding: 11px 9px; }
.papex-meteopulse.papex-meteopulse--layout-1080 .papex-meteopulse__facts { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
.papex-meteopulse.papex-meteopulse--layout-1080 .papex-meteopulse__fact { padding: 0 8px; border-right: 1px solid var(--papex-divider); }
.papex-meteopulse.papex-meteopulse--layout-1080 .papex-meteopulse__fact:first-child { padding-left: 0; }
.papex-meteopulse.papex-meteopulse--layout-1080 .papex-meteopulse__fact:last-child { padding-right: 0; border-right: 0; }


/* Фаза Луны и дата двухчасового прогноза. */
.papex-meteopulse .papex-meteopulse__moon-icon {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    filter: none;
    opacity: 1;
}
.papex-meteopulse .papex-meteopulse__hour-day {
    display: block;
    color: var(--papex-muted);
    font-size: 15px;
    line-height: 1.2;
    margin-bottom: 4px;
}
/* Седьмой параметр не должен сжимать существующие шесть колонок. */
.papex-meteopulse.papex-meteopulse--layout-320 .papex-meteopulse__fact--moon { grid-column: 1 / -1; }
.papex-meteopulse.papex-meteopulse--layout-1080 .papex-meteopulse__facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 14px;
}
.papex-meteopulse.papex-meteopulse--layout-1080 .papex-meteopulse__fact { padding: 0; border-right: 0; }
.papex-meteopulse.papex-meteopulse--layout-1080 .papex-meteopulse__fact--moon { grid-column: auto; }

/* Лунный блок: читаемая подпись под названием, без разрывов внутри слов. */
.papex-meteopulse .papex-meteopulse__moon-icon { width: 32px; height: 32px; flex-basis: 32px; }
.papex-meteopulse .papex-meteopulse__moon-times { margin: 3px 0 0; overflow-wrap: normal; }
.papex-meteopulse .papex-meteopulse__fact--moon strong { overflow-wrap: normal; }
.papex-meteopulse.papex-meteopulse--layout-1080 .papex-meteopulse__fact--moon { grid-column: span 2; }
