/* Weather Hub styles. Conditionally loaded on /weather/ and /es/clima/. */

.whub-section { padding: var(--space-xl) 0; border-top: 1px solid var(--color-border); }
.whub-section:first-of-type { border-top: none; }
.whub-section h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: var(--space-md); }
.whub-section .updated { font-size: 0.75rem; color: var(--color-text-light); margin-bottom: var(--space-md); }

/* Hero — live conditions strip */
.whub-hero { padding: var(--space-xl) 0; }
.whub-hero-tabs { display: flex; gap: 4px; margin-bottom: var(--space-md); overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.whub-hero-tab { padding: var(--space-sm) var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-card-bg); font-weight: 600; font-size: 0.875rem; cursor: pointer; white-space: nowrap; min-height: 44px; color: var(--color-text); }
.whub-hero-tab[aria-selected="true"] { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.whub-hero-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-md); padding: var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-card-bg); }
.whub-hero-metric { text-align: center; }
.whub-hero-metric-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.3px; color: var(--color-text-muted); margin-bottom: 4px; }
.whub-hero-metric-value { font-size: 1.5rem; font-weight: 800; color: var(--color-primary); }
.whub-hero-metric-sub { font-size: 0.75rem; color: var(--color-text-light); margin-top: 2px; }

/* Choropleth container */
.whub-map-container { position: relative; }
.whub-map { height: 480px; border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
.whub-map-layers { display: flex; gap: 4px; margin-bottom: var(--space-md); flex-wrap: wrap; }
.whub-map-layer-btn { padding: var(--space-sm) var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-card-bg); font-weight: 600; font-size: 0.875rem; cursor: pointer; min-height: 44px; color: var(--color-text); }
.whub-map-layer-btn[aria-selected="true"] { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.whub-map-legend { position: absolute; bottom: var(--space-md); left: var(--space-md); background: var(--color-card-bg); padding: var(--space-sm) var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: 0.75rem; z-index: 500; }

/* 7-day forecast */
.whub-forecast { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: var(--space-sm); margin-top: var(--space-md); }
.whub-forecast-day { padding: var(--space-sm); border: 1px solid var(--color-border); border-radius: var(--radius-md); text-align: center; background: var(--color-card-bg); }
.whub-forecast-day-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--color-text-muted); }
.whub-forecast-day-icon { margin: 4px auto; color: var(--color-primary); }
.whub-forecast-day-temp { font-size: 0.875rem; font-weight: 700; }
.whub-forecast-day-rain { font-size: 0.75rem; color: var(--color-secondary); }

/* Rainy season tracker */
.whub-rainy-card { padding: var(--space-lg); border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-card-bg); }
.whub-rainy-hero-num { font-size: 2.5rem; font-weight: 800; color: var(--color-primary); line-height: 1; }
.whub-rainy-narrative { margin-top: var(--space-sm); font-size: 1rem; }

/* Volcanic ash */
.whub-volcanoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-md); }
.whub-volcano { padding: var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-card-bg); }
.whub-volcano-status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.whub-volcano-status.quiet { background: #e6f4ea; color: #0a6b20; }
.whub-volcano-status.active { background: #fef3c7; color: #92400e; }

/* Astro grid */
.whub-astro { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-md); }
.whub-astro-card { padding: var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-card-bg); text-align: center; }

/* UV + AQI compact */
.whub-compact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
@media (max-width: 640px) { .whub-compact-grid { grid-template-columns: 1fr; } }

.whub-aqi-badge { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.whub-aqi-good { background: #e6f4ea; color: #0a6b20; }
.whub-aqi-moderate { background: #fef3c7; color: #92400e; }
.whub-aqi-unhealthy { background: #fee2e2; color: #991b1b; }

/* Best time calendar heatmap */
.whub-best-time { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.whub-best-time-month { padding: var(--space-sm) 4px; text-align: center; font-size: 0.75rem; font-weight: 600; border-radius: 2px; min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
.whub-best-time-label { font-size: 0.625rem; text-transform: uppercase; color: var(--color-text-light); margin-bottom: var(--space-sm); }

/* Stale data banner */
.whub-stale-banner { background: #fef3c7; border: 1px solid #fde68a; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); font-size: 0.875rem; margin-bottom: var(--space-md); }

/* Department embed */
.whub-dept-embed { padding: var(--space-lg); border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-card-bg); margin: var(--space-lg) 0; }

/* Screen-reader-only utility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 640px) {
  .whub-section { padding: var(--space-lg) 0; }
  .whub-map { height: 360px; }
  .whub-hero-panel { grid-template-columns: 1fr 1fr; }
}

/* Intro lead */
.whub-intro { padding: var(--space-lg) 0; border-bottom: 1px solid var(--color-border); margin-bottom: var(--space-lg); }
.whub-intro-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-sm); font-size: 0.875rem; color: var(--color-text-muted); margin-bottom: var(--space-md); }
.whub-intro-byline a { color: var(--color-primary); font-weight: 600; text-decoration: none; }
.whub-intro-byline a:hover { text-decoration: underline; }
.whub-intro-sep { color: var(--color-text-light); }
.whub-intro-body { font-size: 1rem; line-height: 1.7; color: var(--color-text); max-width: var(--max-width-content); }

/* FAQ */
.whub-faq-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.whub-faq-item { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-card-bg); }
.whub-faq-item summary { padding: var(--space-md); font-weight: 700; cursor: pointer; list-style: none; min-height: 44px; display: flex; align-items: center; }
.whub-faq-item summary::-webkit-details-marker { display: none; }
.whub-faq-item summary::after { content: "+"; margin-left: auto; font-size: 1.25rem; color: var(--color-text-muted); }
.whub-faq-item[open] summary::after { content: "-"; }
.whub-faq-answer { padding: 0 var(--space-md) var(--space-md) var(--space-md); font-size: 0.9375rem; line-height: 1.6; color: var(--color-text-muted); }

/* Related links grid */
.whub-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-md); }
.whub-related-card { display: block; padding: var(--space-md); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-card-bg); text-decoration: none; color: inherit; transition: box-shadow 0.15s; }
.whub-related-card:hover { box-shadow: var(--shadow-md); }
.whub-related-card h3 { font-size: 1rem; font-weight: 700; color: var(--color-primary); margin-bottom: 4px; }
.whub-related-card p { font-size: 0.875rem; color: var(--color-text-muted); margin: 0; }

/* Data sources footer */
.whub-sources { background: var(--color-bg-section); padding: var(--space-xl) var(--space-lg); border-radius: var(--radius-lg); }
.whub-sources-list { display: grid; grid-template-columns: 1fr; gap: var(--space-md); }
.whub-sources-list dt { font-weight: 700; font-size: 0.9375rem; margin-bottom: 2px; }
.whub-sources-list dt a { color: var(--color-primary); text-decoration: none; }
.whub-sources-list dt a:hover { text-decoration: underline; }
.whub-sources-list dd { font-size: 0.875rem; color: var(--color-text-muted); margin-left: 0; }
@media (min-width: 768px) { .whub-sources-list { grid-template-columns: 1fr 1fr; column-gap: var(--space-xl); } }

/* Per-widget source attribution */
.whub-source-note { margin-top: var(--space-md); padding-top: var(--space-md); border-top: 1px dashed var(--color-border); font-size: 0.8125rem; color: var(--color-text-muted); line-height: 1.5; }
.whub-source-note strong { color: var(--color-text); font-weight: 700; }

/* Department embed grid */
.whub-dept-embed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: var(--space-sm); }

/* Editorial content section (markdown body rendered above widgets) */
.whub-editorial p { font-size: 1rem; line-height: 1.7; margin-bottom: var(--space-md); max-width: var(--max-width-content); color: var(--color-text); }
.whub-editorial h2 { font-size: 1.25rem; font-weight: 800; margin-top: var(--space-xl); margin-bottom: var(--space-sm); }
.whub-editorial h2:first-child { margin-top: 0; }
.whub-editorial ul { margin-bottom: var(--space-md); padding-left: 1.5em; max-width: var(--max-width-content); }
.whub-editorial ul li { margin-bottom: var(--space-xs); line-height: 1.6; }
.whub-editorial strong { font-weight: 700; color: var(--color-text); }
.whub-editorial a { color: var(--color-primary); }

/* Hero "More departments" dropdown -- sits alongside tabs */
.whub-hero-more {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card-bg);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  min-height: 44px;
  color: var(--color-text);
  font-family: inherit;
  max-width: 240px;
}
.whub-hero-more.whub-hero-tab-selected {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* All 22 Departments widget */
.whub-all-depts { }
.whub-all-depts-toolbar { margin-bottom: var(--space-md); }
.whub-all-depts-filter {
  width: 100%;
  max-width: 360px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-family: inherit;
  min-height: 44px;
  color: var(--color-text);
  background: var(--color-card-bg);
}
.whub-all-depts-filter:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

.whub-all-depts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.whub-all-depts-table thead th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-muted);
  background: var(--color-bg-section);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
  min-height: 44px;
}
.whub-all-depts-table thead th:hover { color: var(--color-primary); }
.whub-all-depts-table thead th.whub-th-sorted { color: var(--color-primary); }
.whub-all-depts-table thead th.whub-th-sorted::after {
  content: "";
  display: inline-block;
  margin-left: 4px;
  border: 4px solid transparent;
}
.whub-all-depts-table thead th[aria-sort="ascending"].whub-th-sorted::after {
  border-bottom-color: var(--color-primary);
  vertical-align: 2px;
}
.whub-all-depts-table thead th[aria-sort="descending"].whub-th-sorted::after {
  border-top-color: var(--color-primary);
  vertical-align: -2px;
}
.whub-all-depts-table tbody td {
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--color-border);
  vertical-align: middle;
}
.whub-all-depts-table tbody tr:hover { background: var(--color-bg-section); }
.whub-all-depts-name { font-size: 0.9375rem; line-height: 1.3; }
.whub-muted { color: var(--color-text-muted); font-size: 0.8125rem; }

/* Mobile cards (hidden by default, visible on narrow viewports) */
.whub-all-depts-cards { display: none; }
.whub-all-depts-card {
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card-bg);
}
.whub-all-depts-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}
.whub-all-depts-card-name { font-weight: 700; font-size: 1rem; color: var(--color-text); }
.whub-all-depts-card-dept { font-size: 0.8125rem; color: var(--color-text-muted); }
.whub-all-depts-card-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-sm);
}
.whub-all-depts-card-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}
.whub-all-depts-card-value { font-size: 0.9375rem; font-weight: 700; color: var(--color-text); }

@media (max-width: 640px) {
  .whub-all-depts-table { display: none; }
  .whub-all-depts-cards { display: block; }
  .whub-all-depts-card-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-xs); }
  .whub-hero-more { max-width: 100%; flex-shrink: 0; }
}
