/* Bermuda Weather — mobile-first */
.bw {
    --bw-bg: #0b1b2b;
    --bw-fg: #ffffff;
    --bw-muted: rgba(255, 255, 255, 0.7);
    --bw-accent: #4fb3ff;
    --bw-divider: rgba(255, 255, 255, 0.12);
    --bw-tile-bg: rgba(255, 255, 255, 0.06);

    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    font-family: var(--bw-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif);
    font-size: var(--bw-font-size, 16px);
    color: var(--bw-fg);
    background: linear-gradient(180deg, #0b1b2b 0%, #14324f 100%);
    border-radius: 14px;
    box-sizing: border-box;
    line-height: 1.4;
}

.bw *,
.bw *::before,
.bw *::after {
    box-sizing: border-box;
}

.bw-error {
    padding: 16px;
    background: #fee;
    color: #900;
    border-radius: 8px;
    font-family: inherit;
}

/* Header */
.bw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.bw-location {
    font-size: 1.125em;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.bw-unit-toggle {
    background: var(--bw-tile-bg);
    border: 1px solid var(--bw-divider);
    color: var(--bw-fg);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.bw-unit-toggle:hover,
.bw-unit-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.bw-unit-sep {
    opacity: 0.4;
    margin: 0 2px;
}

.bw[data-unit="c"] .bw-unit-c { color: var(--bw-accent); }
.bw[data-unit="f"] .bw-unit-f { color: var(--bw-accent); }

/* Now — full-width hero card */
.bw-now {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    background: rgba(79, 179, 255, 0.12);
    border: 1px solid var(--bw-accent);
    border-radius: 14px;
    margin-bottom: var(--bw-gap, 12px);
}

/* A theme's rule for images in content (bbc.bm: ".tagdiv-type img
   { margin-bottom: 21px }") can outrank the icons' own classes. */
.bw img.bw-now-icon,
.bw img.bw-day-icon {
    margin: 0 !important;
}
.bw img.bw-tile-icon {
    margin: 0 auto 2px !important;
}

.bw-now-icon {
    width: 96px;
    height: auto;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.bw-now-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bw-now-label {
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--bw-muted);
    text-transform: uppercase;
}

.bw-now-temp {
    font-size: 2.75em;
    font-weight: 700;
    line-height: 1.05;
    margin: 2px 0 4px;
    font-variant-numeric: tabular-nums;
}

.bw-now-phrase {
    font-size: 0.875em;
    font-weight: 500;
}

.bw-now-wind {
    font-size: 0.8125em;
    color: var(--bw-muted);
    margin-top: 2px;
}

/* Hourly — 4-column grid below Now */
.bw-hourly {
    margin-bottom: calc(var(--bw-gap, 12px) * 1.5);
}

.bw-hourly-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.bw-tile {
    padding: 10px 4px;
    background: var(--bw-tile-bg);
    border-radius: 10px;
    text-align: center;
    min-width: 0;
}

.bw-tile-time {
    font-size: 0.6875em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bw-muted);
    margin-bottom: 4px;
}

.bw-tile-icon {
    width: 40px;
    height: auto;
    display: block;
    margin: 0 auto 2px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.bw-tile-temp {
    font-size: 1.0625em;
    font-weight: 600;
    margin-bottom: 2px;
    font-variant-numeric: tabular-nums;
}

.bw-tile-wind {
    font-size: 0.625em;
    color: var(--bw-muted);
    line-height: 1.2;
    word-break: break-word;
}

/* 5-day forecast */
.bw-daily {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bw-tile-bg);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: var(--bw-gap, 10px);
}

.bw-day {
    display: grid;
    grid-template-columns: 70px 44px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--bw-divider);
}

.bw-day:last-child {
    border-bottom: none;
}

.bw-day-name {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.bw-day-dow {
    font-weight: 600;
    font-size: 0.9375em;
}

.bw-day-date {
    font-size: 0.6875em;
    color: var(--bw-muted);
    margin-top: 2px;
}

.bw-day-icon {
    width: 42px;
    height: auto;
    justify-self: center;
}

.bw-day-desc {
    font-size: 0.8125em;
    color: var(--bw-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bw-day-temps {
    display: flex;
    gap: 10px;
    font-size: 0.9375em;
    font-weight: 600;
    justify-self: end;
    font-variant-numeric: tabular-nums;
}

.bw-day-hi::after {
    content: "";
}

.bw-day-lo {
    color: var(--bw-muted);
    font-weight: 500;
}

/* Footer */
.bw-footer {
    text-align: center;
    padding-top: 4px;
}

.bw-credit {
    font-size: 0.6875em;
    color: var(--bw-muted);
    text-decoration: none;
    letter-spacing: 0.3px;
}

.bw-credit:hover {
    color: var(--bw-fg);
    text-decoration: underline;
}

/* Very narrow screens — collapse daily row into two rows so description isn't squeezed */
@media (max-width: 360px) {
    .bw {
        padding: 12px;
        border-radius: 10px;
    }
    .bw-now {
        grid-template-columns: 78px 1fr;
        gap: 10px;
        padding: 12px;
    }
    .bw-now-icon { width: 78px; }
    .bw-now-temp { font-size: 38px; }
    .bw-hourly-row { gap: 6px; }
    .bw-tile {
        padding: 8px 2px;
        border-radius: 8px;
    }
    .bw-tile-icon { width: 36px; }
    .bw-tile-time { font-size: 10px; }
    .bw-tile-temp { font-size: 15px; }
    .bw-tile-wind { font-size: 9px; }
    .bw-day {
        grid-template-columns: 44px 1fr auto;
        grid-template-areas:
            "icon name temps"
            "icon desc desc";
        padding: 10px;
        gap: 4px 10px;
    }
    .bw-day-icon {
        grid-area: icon;
        width: 40px;
        align-self: center;
    }
    .bw-day-name {
        grid-area: name;
    }
    .bw-day-temps {
        grid-area: temps;
    }
    .bw-day-desc {
        grid-area: desc;
        font-size: 12px;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

/* Light-background theme override (if the host page has a light background) */
@media (prefers-color-scheme: light) {
    /* Keep dark-on-dark look — weather widgets typically pop against dark bg.
       Remove this block if you want to auto-switch to light. */
}
