/**
 * Global Weather Pro - Main Styles
 * Theme loader and base styles for the weather widget
 * 
 * Theme System:
 * - Dark Theme: gwpro-dark-theme.css
 * - Light Theme: gwpro-light-theme.css
 * - Alert Styles: alert-icon-styles.css
 */

/* ============================================= */
/* Global Reset & Base Styles                   */
/* ============================================= */

/* Scoped to the widgets and their alert dialogs (the header dialog is moved
   to <body>, outside its container). These used to be bare `*` and `body`
   rules, which reset margins/padding and replaced the font on every element
   of the host site on any page showing a widget.
   :where() keeps the reset at zero specificity, exactly as the old `*` was,
   so every other widget rule still wins over it as before. */
:where(.weather-widget-container, .alert-modal),
:where(.weather-widget-container, .alert-modal) * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Fallback stack only: the selected plugin font is applied by the inline
   rule from gwpro_get_font_inline_css(), which outranks this. */
.weather-widget-container,
:where(.weather-widget-container, .gwpro-alert-dialog) .alert-modal,
.alert-modal:where(.gwpro-alert-dialog) {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================= */
/* Transition Defaults                          */
/* ============================================= */

.weather-widget-header,
.weather-widget-sidebar,
.weather-widget-header *,
.weather-widget-sidebar * {
  transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable transitions for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .weather-widget-header,
  .weather-widget-sidebar,
  .weather-widget-header *,
  .weather-widget-sidebar * {
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================= */
/* Utility Classes                              */
/* ============================================= */

/* No-select utility */
:where(.weather-widget-container, .gwpro-alert-dialog) .no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Screen reader only - Accessibility */
:where(.weather-widget-container, .gwpro-alert-dialog) .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Visually hidden but focusable */
:where(.weather-widget-container, .gwpro-alert-dialog) .sr-only-focusable:focus,
:where(.weather-widget-container, .gwpro-alert-dialog) .sr-only-focusable:active {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ============================================= */
/* Container Base Styles                        */
/* ============================================= */

.weather-widget-container {
  width: 100%;
  max-width: 100%;
}

#weather-widget-container-header,
#weather-widget-container-sidebar {
  width: 100%;
}

/* ============================================= */
/* Focus Styles for Accessibility               */
/* ============================================= */

/* Custom focus ring for interactive elements */
.weather-widget-header a:focus-visible,
.weather-widget-header button:focus-visible,
.weather-widget-sidebar a:focus-visible,
.weather-widget-sidebar button:focus-visible,
:where(.weather-widget-container, .gwpro-alert-dialog) [data-role="unit-toggle"]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Remove default outline when using focus-visible */
.weather-widget-header a:focus:not(:focus-visible),
.weather-widget-header button:focus:not(:focus-visible),
.weather-widget-sidebar a:focus:not(:focus-visible),
.weather-widget-sidebar button:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================= */
/* Skip Link for Accessibility                  */
/* ============================================= */

.gwpro-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  z-index: 100;
  text-decoration: none;
  font-weight: 600;
}

.gwpro-skip-link:focus {
  top: 0;
}

/* ============================================= */
/* Bottom-right controls (buttons + alert)       */
/* ============================================= */

/* Make the tab wrapper a positioning context */
.weather-widget-header {
  position: relative;
}

/* ============================================= */
/* Server-rendered summary (v2.12.0)            */
/* ============================================= */

/* Plain-text forecast printed by PHP inside each widget's <section>
   (includes/gwpro-summary.php). Crawlers, link previews and visitors without
   JavaScript read this; everyone else sees it only until the widget script
   replaces it. The card reuses .weather-widget-header / .weather-widget-sidebar,
   so background, border, radius, margins and the selected font all come from
   the active theme stylesheet - these rules only lay out the text. */

.gwpro-summary-body > * + * {
  margin-top: 0.5em;
}

.gwpro-summary-place {
  font-size: 1.25em;
  font-weight: 700;
  line-height: 1.3;
  color: var(--gwpro-text-primary, var(--gw-ink, inherit));
}

.gwpro-summary-now {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25em 0.75em;
}

.gwpro-summary--sidebar .gwpro-summary-now {
  justify-content: center;
}

.gwpro-summary-temp {
  font-size: 2em;
  font-weight: 700;
  line-height: 1.1;
  color: var(--gwpro-text-primary, var(--gw-ink, inherit));
}

.gwpro-summary-condition {
  font-size: 1.125em;
  color: var(--gwpro-text-primary, var(--gw-ink, inherit));
}

.gwpro-summary-details,
.gwpro-summary-days,
.gwpro-summary-updated {
  font-size: 0.9375em;
  color: var(--gwpro-text-secondary, var(--gw-ink-2, inherit));
}

/* Amber chosen per theme for WCAG AA contrast against the card background. */
.gwpro-summary-alerts {
  font-weight: 600;
  color: #fbbf24;
}

.gwpro-summary--light .gwpro-summary-alerts {
  color: #92400e;
}

.gwpro-summary-days {
  list-style: none;
}

.gwpro-summary-days li + li {
  margin-top: 0.25em;
}

.gwpro-summary-day {
  font-weight: 600;
  color: var(--gwpro-text-primary, var(--gw-ink, inherit));
}

.gwpro-summary-day::after {
  content: ": ";
}

.gwpro-summary-updated {
  font-size: 0.8125em;
  /* Header themes: secondary, not muted - muted text is below 4.5:1 there. */
  color: var(--gwpro-text-secondary, var(--gw-muted, inherit));
}

/* Reserve the finished widget's height so the page does not jump when the
   script swaps the summary for the widget (Cumulative Layout Shift).
   Heights were measured from the rendered widgets; each is the smaller of the
   light and dark themes, so the swap can only grow the box by a few pixels,
   never shrink it. The height is fixed rather than a minimum, and any summary
   text that does not fit is clipped, because this box is only on screen for
   the moment before the script runs.
   Applied only when scripting is enabled: without JavaScript the summary is
   all there is, so it keeps its natural height and every line stays visible.
   Browsers without the `scripting` media feature skip the reservation.
   Each height was measured at the default 16px font size. The widget text
   scales with --gwpro-font-size (Settings > Font Size) while images and video
   do not, so the widget grows by a near-constant number of pixels per pixel
   of font size in each layout; that rate was measured at 12-24px and is
   added on. --gwpro-font-size is unset at the default size, so these
   resolve to the original heights. */
@media (scripting: enabled) {
  /* Header: desktop, tablet (stacked layout) and phones (collapsed card). */
  .gwpro-summary--header {
    height: calc(426px + (var(--gwpro-font-size, 16px) - 16px) * 29);
    overflow: hidden;
  }

  @media (max-width: 900px) {
    .gwpro-summary--header {
      height: calc(840px + (var(--gwpro-font-size, 16px) - 16px) * 54);
    }
  }

  @media (max-width: 600px) {
    .gwpro-summary--header {
      height: calc(345px + (var(--gwpro-font-size, 16px) - 16px) * 28);
    }
  }

  /* Narrow phones: the temperature row wraps below the condition video. */
  @media (max-width: 500px) {
    .gwpro-summary--header {
      height: calc(405px + (var(--gwpro-font-size, 16px) - 16px) * 26);
    }
  }

  /* Sidebar: the card is its own size container, so the reservation sits on
     the inner body (a container query cannot size the container itself).
     Values are the card height minus its 18px padding and 1px border. */
  .gwpro-summary--sidebar .gwpro-summary-body {
    height: calc(368px + (var(--gwpro-font-size, 16px) - 16px) * 12.5);
    overflow: hidden;
  }

  @container gwpro-sidebar (max-width: 264px) {
    .gwpro-summary--sidebar .gwpro-summary-body {
      height: calc(498px + (var(--gwpro-font-size, 16px) - 16px) * 20);
    }
  }

  @container gwpro-sidebar (max-width: 208px) {
    .gwpro-summary--sidebar .gwpro-summary-body {
      height: calc(484px + (var(--gwpro-font-size, 16px) - 16px) * 22);
    }
  }
}

/* ============================================= */
/* Print Styles                                 */
/* ============================================= */

@media print {
  .weather-widget-header,
  .weather-widget-sidebar {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }

  .weather-widget-header::before,
  .weather-widget-sidebar::before {
    display: none !important;
  }

  :where(.weather-widget-container, .gwpro-alert-dialog) .alert-icon-class,
  :where(.weather-widget-container, .gwpro-alert-dialog) .forecast-toggle-controls {
    display: none !important;
  }
}
/* ============================================================================
   Font-Independent Layout Normalization
   ============================================================================
   The Typography setting now offers 18 fonts with very different metrics
   (x-heights, character widths, default leading). These rules pin down every
   dimension that a font could otherwise influence, so the widget layout stays
   identical no matter which font the user selects.
   ========================================================================= */

/* 1. Normalize optical size and vertical rhythm.
   - font-size-adjust scales every font so its x-height matches Roboto's
     (aspect ~0.52), so small-x-height serifs (EB Garamond, Playfair Display)
     don't render visually smaller than the sans-serifs at the same em size.
     Browsers without support simply ignore it.
   - An explicit unitless line-height overrides each font's own default
     leading, which otherwise varies enough to shift rows vertically. */
.weather-widget-header,
.weather-widget-sidebar {
  font-size-adjust: 0.52;
  line-height: 1.4;
  /* Tabular (fixed-width) numerals keep temperatures, times, and
     percentages the same width in every font, including proportional
     serifs, so columns don't jitter between values. */
  font-variant-numeric: tabular-nums lining-nums;
}

/* 2. Interactive controls never wrap or reflow in wide fonts.
   Playfair Display and Merriweather are ~15-20% wider than Roboto; without
   nowrap, tab labels like "Precipitation" or "UV Index" wrap to two lines
   and change the tab bar height. */
.weather-widget-header .tablinks,
.weather-widget-header .forecast-toggle-btn,
.weather-widget-header .unit-toggle-btn,
.weather-widget-sidebar .unit-toggle-btn {
  white-space: nowrap;
}

/* 3. Fixed-width forecast columns.
   The theme stylesheets give hourly cells only a min-width, so wide fonts
   grow individual columns and desynchronize the strip. Locking flex-basis
   and width makes column geometry font-independent. (Widget-class prefix
   deliberately out-specifies the equal-specificity theme rules, which load
   after this file.) */
.weather-widget-header #gwpro-hourly-tabs .flex-tabcontent > div,
.weather-widget-header #gwpro-seven-day-tabs .flex-tabcontent > div {
  flex: 0 0 5em;
  width: 5em;
  max-width: 5em;
  min-width: 5em;
  text-align: center;
}

/* 4. Truncate overflow inside fixed columns instead of breaking layout.
   Each cell stacks three block rows (label, icon, value); any row whose
   text exceeds the fixed column width ellipsizes. Full values remain
   available via existing title/aria-label attributes (e.g. AQI badges). */
.weather-widget-header .flex-tabcontent > div > div {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 5. Cap the weather location's line length so long addresses wrap early
   instead of pushing right-side elements out of position.
   30ch fits roughly 32 proportional characters per line (the width of
   "University of Florida, Southwest"), so e.g.
   "University of Florida, Southwest 40th Place, Gainesville, FL, US"
   renders as two-to-three short lines inside a fixed-width box. Because
   ch is font-relative, the cap tracks the selected font automatically:
   wide fonts get a wider box, monospace wider still, but always the same
   character count — so the elements to the right of the location sit in
   the same place no matter the font or the address length. The min()
   guard keeps the box from exceeding its container on narrow screens.
   (Widget-class prefix out-specifies the themes' max-width: 100% rules.) */
.weather-widget-header .weather-city,
.weather-widget-sidebar .weather-location {
  max-width: min(30ch, 100%);
  white-space: normal;
  overflow-wrap: break-word;
}

/* 6. Column discipline for the header's top row.
   The location column yields (shrinks) when space is tight; the two
   parameter columns are rigid and content-sized, and their label/value
   rows never wrap — so values like "0.23 mm" can't break onto a second
   line when a wide font eats the horizontal space. Any remaining box
   slack on the wrapped location heading is removed at runtime by
   gwproFitLocationWidth() in weatherApiAdapter.js, which pins the
   heading's width to its widest rendered line. */
.weather-widget-header .custom-flex-col1 {
  flex: 0 1 auto;
  min-width: 0;
}

.weather-widget-header .custom-flex-col2,
.weather-widget-header .custom-flex-col3 {
  flex: 0 0 auto;
}

.weather-widget-header .custom-flex-col2 > div,
.weather-widget-header .custom-flex-col3 > div {
  white-space: nowrap;
}

/* 7. Narrow cards on wide screens (v2.13.0).
   The stacked tablet layout is switched on by the viewport width (900px),
   but the card can be far narrower than the viewport, e.g. in a content
   column on a desktop. The rigid parameter columns are sized in em, so with
   a larger font size they took the whole row and squeezed the yielding
   location column down to one letter per line.
   The card is now a size container: when it is narrower than 36em (576px
   at the default 16px, more at larger sizes because em follows the card's
   own font size) the top row wraps, the location and temperature take the
   full width, and the two parameter columns sit side by side beneath them.
   The 576px floor keeps the layout unchanged for fonts below 16px. Applied
   above the tablet breakpoint only; below it the stacked layout already
   handles narrow widths. */
.weather-widget-header {
  container: gwpro-header / inline-size;
}

/* 8. The temperature row never spills into the parameter columns (v2.13.0).
   The row (condition video, temperature, F/C toggle) was a single line that
   could not wrap. The location column it sits in yields when space is tight
   (rule 6), so with a larger font size or a narrower card the column became
   narrower than the row, the row overflowed sideways under the parameter
   column, and that column was painted on top of the unit toggle, so the F/C
   buttons could not be clicked. Letting the row wrap keeps everything inside
   its own column: the temperature and toggle move below the video instead.
   Where the column is wide enough, nothing wraps and nothing changes. */
.weather-widget-header .custom-row {
  flex-wrap: wrap;
}

/* Same idea for the 7 DAY / HOURLY pair at any width: it may shrink to the
   card and wrap onto a second line rather than run past the card's edge,
   where `overflow: hidden` on the card would clip it. Phones get an
   equal-halves layout further down. */
.weather-widget-header .forecast-toggle-row {
  flex-shrink: 1;
  flex-wrap: wrap;
  max-width: 100%;
}

@media (min-width: 901px) {
  @container gwpro-header (max-width: 36em) or (max-width: 576px) {
    .weather-widget-header .flex-row1 {
      flex-wrap: wrap;
    }

    .weather-widget-header .custom-flex-col1 {
      flex: 1 1 100%;
    }
  }
}

/* 7b. Content-column widths (v2.15.0).
   In a typical post or page column (about 600-700px, e.g. Twenty Twenty-Five's
   645px) the eight category tabs and the 7 DAY / HOURLY pair need about
   1000px on one line. The tab strip scrolled with a hidden scrollbar, so on a
   desktop the Visibility, UV Index and AQI tabs were simply cut off, and the
   seven fixed 5em day columns (656px) overflowed the card and were clipped.
   Below 62em of card width (above phone size, which has its own layout):
   the tabs sit in a four-column grid on two rows, the 7 DAY / HOURLY pair
   moves to its own line, and the seven day columns share the width equally.
   The hourly strip keeps its visible scroll container: 24 hours never fit. */
@media (min-width: 601px) {
  @container gwpro-header (max-width: 62em) {
    .weather-widget-header .tab-wrapper {
      flex-direction: column;
      align-items: stretch;
      gap: 0.5em;
    }

    .weather-widget-header .tab-wrapper .tab {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 0.375em;
      flex: none; /* the wrapper is a column now: flex-grow would stretch it tall */
      height: auto;
      align-content: start;
      width: 100%;
      max-width: 100%;
      overflow: visible;
      margin: 0;
    }

    .weather-widget-header .tab-wrapper .tab .tablinks {
      width: 100%;
      min-width: 0;
      margin: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      text-align: center;
    }

    .weather-widget-header .tab-wrapper .forecast-toggle-row {
      align-self: flex-end;
      margin-left: 0;
    }

    .weather-widget-header #gwpro-days-html-div > .flex-row > * {
      flex: 1 1 100%;
      min-width: 0;
    }

    .weather-widget-header #gwpro-seven-day-tabs .tabcontent,
    .weather-widget-header #gwpro-seven-day-tabs .flex-tabcontent {
      width: 100%;
      min-width: 0;
      max-width: 100%;
    }

    .weather-widget-header #gwpro-seven-day-tabs .flex-tabcontent > div {
      flex: 1 1 0;
      width: auto;
      min-width: 0;
      max-width: none;
    }
  }
}

/* Neutral setup / failure message shown in place of widget content.
   Used when no location has been configured, or when weather data
   could not be loaded. Inherits the widget's own font and colours so it
   does not look like a broken element. */
.gwpro-setup-message {
    padding: 1.5em 1em;
    margin: 0;
    text-align: center;
    font-size: 0.95em;
    line-height: 1.5;
    opacity: 0.85;
}

/* ============================================================================
   Phone Layout (<= 600px)
   ============================================================================
   The header widget was previously removed on phones by a userAgent test in
   headerWidget.js. It now renders everywhere, so this block reflows the
   desktop three-column layout into a single-column card.

   Two things made the widget unusable at phone width before:

   1. The 7-day strip has no .scroll-container (unlike the hourly strip), and
      main-styles pins every forecast column to a fixed 5em. Seven columns plus
      gaps is ~41em / 656px, which forced horizontal scrolling on the whole
      PAGE, not just the strip.
   2. .forecast-toggle-row and .alert-container are absolutely positioned
      against the article with right/bottom offsets sized for a wide card, so
      at phone width they landed on top of the forecast content.

   All selectors are prefixed with .weather-widget-header so they out-specify
   the single-class rules in gwpro-dark-theme.css / gwpro-light-theme.css,
   which are injected after this stylesheet. Nothing here applies above 600px.
   ========================================================================= */

/* The disclosure control exists in the markup at every width but is only ever
   shown on phones. */
.gwpro-mobile-expand-row {
  display: none;
}

/* Category tab strips: one row at every width.
   The theme stylesheets let the eight tabs wrap, and this file only switched
   to a single row below 600px. From 601px up, and in any narrow content
   column on a desktop, the strip broke onto a second or third row, often
   leaving AQI alone on the last one. Wrapping depends on the widget's width,
   not the screen's, so no viewport breakpoint can prevent it; one scrollable
   row can. Where all eight tabs fit, nothing scrolls and nothing changes.

   justify-content MUST be flex-start. Both theme stylesheets set
   `.tab { justify-content: center }` inside their own max-width:900px block,
   which is harmless while the tabs wrap, but breaks a horizontal scroll
   container: centred content overflows equally in both directions, and the
   part that overflows past the container's left edge sits at a negative
   offset that scrollLeft cannot reach (it is clamped at 0). The end of the
   strip stays reachable, so the symptom is one-sided - you can swipe to the
   last tab but cannot swipe back to the first.

   (Widget-class prefix out-specifies the theme stylesheets' `.tab` and
   `.tablinks` rules, which load after this file.) */
.weather-widget-header .tab {
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* A scroll container clips anything outside its padding box, which would
     cut off the 4px focus ring (2px offset + 2px outline) on every tab.
     4px of padding gives the ring room; the matching negative margins keep
     the tabs exactly where they sat before. */
  padding: 4px;
  scroll-padding-inline: 4px;
  margin: calc(1em - 4px) -4px calc(0.5em - 4px);
}

.weather-widget-header .tab::-webkit-scrollbar {
  display: none;
}

/* Tabs keep their natural width instead of shrinking and clipping labels. */
.weather-widget-header .tablinks {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

/* Slim scrollbar for mouse users only.
   Touch screens swipe, trackpads scroll sideways and keyboard focus scrolls
   each tab into view, so the scrollbar stays hidden for those. A plain mouse
   wheel cannot scroll sideways, so without a visible bar the tabs past the
   edge (often AQI) were unreachable for mouse users. The bar only appears
   when the row actually overflows, and uses the active theme's colours.
   Firefox and Chrome/Edge 121+ use scrollbar-width/-color; Safari and older
   Chrome use the ::-webkit-scrollbar rules (Chrome ignores those once the
   standard properties are set). */
@media (hover: hover) and (pointer: fine) {
  .weather-widget-header .tab {
    scrollbar-width: thin;
    scrollbar-color: var(--gwpro-text-muted, #94a3b8) transparent;
  }

  .weather-widget-header .tab::-webkit-scrollbar {
    display: block;
    height: 6px;
  }

  .weather-widget-header .tab::-webkit-scrollbar-track {
    background: transparent;
  }

  .weather-widget-header .tab::-webkit-scrollbar-thumb {
    background: var(--gwpro-text-muted, #94a3b8);
    border-radius: 3px;
  }
}

@media (max-width: 600px) {
  /* --- Card shell ------------------------------------------------------- */

  /* Flex column so the alert notice can be pulled above the fold with order,
     independent of its position at the end of the markup. */
  .weather-widget-header {
    display: flex;
    flex-direction: column;
    padding: 0.875em;
    margin: 0.5em 0;
  }

  .weather-widget-header .flex-row1 { order: 1; }
  .weather-widget-header .alert-container { order: 2; }
  .weather-widget-header .gwpro-mobile-expand-row { order: 3; }
  .weather-widget-header #gwpro-seven-day-tabs { order: 4; }
  .weather-widget-header #gwpro-hourly-tabs { order: 5; }

  /* --- Current conditions ---------------------------------------------- */

  /* The 900px breakpoint turns every .flex-row into a column, which also
     stacks the icon, temperature and unit toggle. Keep that hero row
     horizontal - it is the widget's signature element. */
  .weather-widget-header .custom-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em;
  }

  .weather-widget-header .weather-city {
    font-size: 1.25em;
  }

  /* --- Parameter columns ------------------------------------------------ */

  /* The two parameter columns (rain chance, gusts, UV, sunrise, low /
     precipitation, visibility, humidity, sunset, high) are hidden outright on
     phones rather than reflowed. Ten label/value pairs is a lot of dense text
     on a small screen, and all but two of those figures are also present in
     the forecast strips, which are the better place to read them.

     The exceptions are sunrise and sunset: there is no forecast tab for
     either, so hiding these columns removes both from the phone layout
     entirely. If they need to come back, the place for them is the summary
     card above, not a re-expanded column.

     This is unconditional at phone width - it is not tied to the collapsed
     state, so the disclosure control reveals the forecast only. */
  .weather-widget-header .custom-flex-col2,
  .weather-widget-header .custom-flex-col3 {
    display: none;
  }

  /* --- Tab strips ------------------------------------------------------- */

  /* Eight category tabs wrap into four rows at phone width. One swipeable row
     with snap points keeps the control compact and the card height stable.

     justify-content MUST be flex-start here. Both theme stylesheets set
     `.tab { justify-content: center }` inside their own max-width:900px block,
     which is harmless while the tabs wrap, but breaks a horizontal scroll
     container: centred content overflows equally in both directions, and the
     part that overflows past the container's left edge sits at a negative
     offset that scrollLeft cannot reach (it is clamped at 0). The end of the
     strip stays reachable, so the symptom is one-sided - you can swipe to the
     last tab but cannot swipe back to the first. */
  /* The single swipeable row itself is set for every width further up
     ("Category tab strips"); only the phone sizing lives here. */
  .weather-widget-header .tab {
    margin: calc(0.75em - 4px) -4px calc(0.5em - 4px);
  }

  /* 2.75em against a 0.85em font is ~44px: the minimum comfortable touch
     target (WCAG 2.5.8 asks for 24px, platform guidance for 44px). */
  .weather-widget-header .tablinks {
    display: inline-flex;
    align-items: center;
    min-height: 2.75em;
    padding: 0.5em 0.9em;
    font-size: 0.85em;
  }

  /* --- Forecast strips -------------------------------------------------- */

  /* Give the 7-day strip the horizontal scroll the hourly strip already has,
     so seven fixed-width columns can no longer overflow the page. */
  .weather-widget-header #gwpro-seven-day-tabs .tabcontent,
  .weather-widget-header #gwpro-hourly-tabs .scroll-container {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  /* 4.5em columns fit four-and-a-bit per screen at 360px, which reads as
     "there is more to swipe" rather than as a clipped column. */
  .weather-widget-header #gwpro-hourly-tabs .flex-tabcontent > div,
  .weather-widget-header #gwpro-seven-day-tabs .flex-tabcontent > div {
    flex: 0 0 4.5em;
    width: 4.5em;
    min-width: 4.5em;
    max-width: 4.5em;
  }

  /* Same reasoning as .tab above: a centred flex row inside a horizontal
     scroll container loses its leading items. */
  .weather-widget-header .flex-tabcontent {
    justify-content: flex-start;
    gap: 0.5em;
  }

  /* --- Controls that were absolutely positioned ------------------------- */

  .weather-widget-header .forecast-toggle-row,
  .weather-widget-header .alert-container {
    position: static;
    right: auto;
    bottom: auto;
    justify-content: flex-start;
    padding: 0;
    margin: 0.25em 0;
  }

  .weather-widget-header .forecast-toggle-btn {
    min-height: 2.5em;
  }

  /* The 7 DAY / HOURLY pair was sized to its content and could not shrink
     (`flex: 0 0 auto` in the theme stylesheets), so with a larger font size
     the HOURLY button ran past the card's right edge and was clipped. On
     phones the pair now shares the full width in two equal halves, with
     narrower side padding, so both buttons always stay in view. */
  .weather-widget-header .forecast-toggle-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  .weather-widget-header .forecast-toggle-row .forecast-toggle-btn,
  .weather-widget-header .forecast-toggle-row #gwpro-hourly-button,
  .weather-widget-header .forecast-toggle-row #gwpro-seven-day-button {
    min-width: 0;
    padding-left: 0.5em;
    padding-right: 0.5em;
  }

  /* --- Disclosure control ---------------------------------------------- */

  .weather-widget-header .gwpro-mobile-expand-row {
    display: block;
    margin: 0.75em 0 0.25em 0;
  }

  /* currentColor and transparent rather than theme variables, so the control
     inherits whichever palette (dark or light) is active without needing a
     copy in each theme stylesheet. */
  .weather-widget-header .gwpro-mobile-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    width: 100%;
    min-height: 2.75em;
    padding: 0.625em 1em;
    font: inherit;
    font-size: 0.875em;
    font-weight: 600;
    /* The header card does not set its own text colour, so `inherit` picked
       up the host theme's body colour - near-black on the dark card. Use the
       active palette's text colour; outside the widget it falls back to the
       inherited colour as before. */
    color: var(--gwpro-text-primary, currentColor);
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 0.5em;
    opacity: 0.85;
    cursor: pointer;
  }

  .weather-widget-header .gwpro-mobile-expand:hover {
    opacity: 1;
  }

  .weather-widget-header .gwpro-mobile-expand-chevron {
    display: inline-block;
    transform: rotate(180deg);
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* --- Collapsed state -------------------------------------------------- */

  /* toggleSevenDayHourly() sets `display` as an inline style on these two
     regions, so the collapsed state has to out-rank an inline declaration.
     This is the one place !important is load-bearing rather than cosmetic. */
  .weather-widget-header.gwpro-mobile-collapsed #gwpro-seven-day-tabs,
  .weather-widget-header.gwpro-mobile-collapsed #gwpro-hourly-tabs {
    display: none !important;
  }

  .weather-widget-header.gwpro-mobile-collapsed .gwpro-mobile-expand-chevron {
    transform: rotate(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .weather-widget-header .gwpro-mobile-expand-chevron {
    transition: none;
  }
}

/* ============================================= */
/* Condition video and pause/play (WCAG 2.2.2)   */
/* ============================================= */

/* The condition animation is a muted, looping 16:9 <video>
   (js/headerWidget.js) shown in a rounded frame beside the temperature.

     desktop        192 x 108   (12em)
     tablet <=900px 224 x 126   (14em)
     phone  <=600px full-width banner, up to 360 x 203

   The frame keeps its 16:9 shape before the poster or video arrives, so the
   row never jumps. Corner radius and shadow come from the light/dark theme
   stylesheets. */
.weather-widget-header .gwpro-condition-media {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 12em;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  line-height: 0;
  background: rgba(127, 127, 127, 0.18);
}

/* Same frame whether it holds the video or, for conditions without an
   animation yet, the static image. */
.weather-widget-header .gwpro-condition-media #gwpro-current-condition-icon {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-fit: cover;
  border-radius: 0;
  filter: none;
  pointer-events: none;
}

/* Legacy animated WebPs (webp-animations/, used until a condition has a
   video) may not be 16:9, so show them whole, centred in the frame, rather
   than cropped. The frame's own background and shadow are dropped so a
   square image does not sit inside a visible widescreen box. */
/* The frame keeps the 16:9 frame's height but shrinks to the image's own
   width, so a square image keeps its proportions and the pause button sits on
   its corner. Browsers without :has() fall back to the image contained,
   uncropped, in the 16:9 frame. */
.weather-widget-header .gwpro-condition-media #gwpro-current-condition-icon.gwpro-condition-animated {
  object-fit: contain;
}

.weather-widget-header .gwpro-condition-media:has(.gwpro-condition-animated) {
  --gwpro-legacy-height: 6.75em; /* 108px, the 16:9 frame's desktop height */
  width: auto;
  height: var(--gwpro-legacy-height);
  aspect-ratio: auto;
  background: transparent;
}

.weather-widget-header .gwpro-condition-media:has(.gwpro-condition-animated) #gwpro-current-condition-icon {
  width: auto;
  max-width: 100%;
  height: 100%;
}

@media (max-width: 900px) {
  .weather-widget-header .gwpro-condition-media:has(.gwpro-condition-animated) {
    --gwpro-legacy-height: 7.875em; /* 126px */
  }
}

@media (max-width: 600px) {
  .weather-widget-header .gwpro-condition-media:has(.gwpro-condition-animated) {
    --gwpro-legacy-height: 10em; /* 160px */
    flex-basis: auto;
  }
}

@media (max-width: 900px) {
  /* The tablet breakpoint stacks every .flex-row into a column; keep the
     video, temperature and unit toggle side by side. */
  .weather-widget-header .custom-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .weather-widget-header .gwpro-condition-media {
    width: 14em;
  }
}

@media (max-width: 600px) {
  /* Phones: the video becomes a banner across the summary card, with the
     temperature and unit toggle on the line below. */
  .weather-widget-header .gwpro-condition-media {
    flex-basis: 100%;
    width: 100%;
    max-width: 22.5em;
  }
}

.weather-widget-header .gwpro-motion-toggle {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  right: 0.375em;
  bottom: 0.375em;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(15, 23, 36, 0.72);
  color: #ffffff;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.weather-widget-header .gwpro-condition-media:hover .gwpro-motion-toggle,
.weather-widget-header .gwpro-motion-toggle:focus-visible,
.weather-widget-header .gwpro-motion-toggle[aria-pressed="true"] {
  opacity: 1;
}

.weather-widget-header .gwpro-motion-toggle .gwpro-icon-play,
.weather-widget-header .gwpro-motion-toggle[aria-pressed="true"] .gwpro-icon-pause {
  display: none;
}

.weather-widget-header .gwpro-motion-toggle[aria-pressed="true"] .gwpro-icon-play {
  display: block;
}

@media (hover: none) {
  .weather-widget-header .gwpro-motion-toggle {
    opacity: 1;
  }
}

/* ============================================= */
/* Block alignment (block.json "align" support)  */
/* ============================================= */

/* The sidebar card is a fixed-width object, so when it is floated left or
   right it needs an explicit width, and centering needs auto margins. */
.gwpro-weather-block.alignleft,
.gwpro-weather-block.alignright {
  width: 100%;
  max-width: 340px;
}

.gwpro-weather-block.aligncenter {
  margin-left: auto;
  margin-right: auto;
  max-width: 340px;
}

.gwpro-weather-block.alignleft {
  margin-right: 1.5em;
}

.gwpro-weather-block.alignright {
  margin-left: 1.5em;
}
