/* ─── Custom properties ───────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather {
  --color-warm: #e05c2a;
  --color-cool: #2a7ae0;
  --color-neutral: #888;
  --color-bg: #f9f9f7;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #666;
  --color-border: #e0e0e0;
  --color-shadow: rgba(0, 0, 0, 0.07);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 8px;
  --padding: 1.5rem;
  --max-width: 960px;
}

@media (prefers-color-scheme: dark) {
  .lw-project-runtime--compare-weather {
    --color-bg: #111110;
    --color-surface: #1c1c1a;
    --color-text: #e8e8e4;
    --color-text-muted: #888;
    --color-border: #2e2e2c;
    --color-shadow: rgba(0, 0, 0, 0.45);
  }
}

/* ─── Reset & base ────────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather,
.lw-project-runtime--compare-weather *,
.lw-project-runtime--compare-weather *::before,
.lw-project-runtime--compare-weather *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Ensure the hidden attribute always wins, even against display:flex rules */
.lw-project-runtime--compare-weather [hidden] {
  display: none !important;
}

.lw-project-runtime--compare-weather {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.lw-project-runtime--compare-weather a {
  color: var(--color-cool);
  text-decoration: none;
}

.lw-project-runtime--compare-weather a:hover {
  text-decoration: underline;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem var(--padding) 1rem;
}

.lw-project-runtime--compare-weather header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lw-project-runtime--compare-weather .subtitle {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-top: 0.2rem;
}

/* ─── Loading state ───────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 5rem var(--padding);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.lw-project-runtime--compare-weather .spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-cool);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Main layout ─────────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--padding) var(--padding);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─── Summary banner ──────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .banner {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1.1rem var(--padding);
  font-size: 1rem;
  font-weight: 500;
  border-left: 4px solid var(--color-neutral);
  box-shadow: 0 1px 4px var(--color-shadow);
  line-height: 1.4;
}

.lw-project-runtime--compare-weather .banner-warm {
  border-left-color: var(--color-warm);
}

.lw-project-runtime--compare-weather .banner-cool {
  border-left-color: var(--color-cool);
}

.lw-project-runtime--compare-weather .banner-neutral {
  border-left-color: var(--color-neutral);
}

.lw-project-runtime--compare-weather .banner strong {
  color: var(--color-warm);
}

.lw-project-runtime--compare-weather .banner-cool strong {
  color: var(--color-cool);
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--padding);
  box-shadow: 0 1px 4px var(--color-shadow);
  border: 1px solid var(--color-border);
}

.lw-project-runtime--compare-weather .card h2 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

/* Two-column row for rain + wind */
.lw-project-runtime--compare-weather .card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 640px) {
  .lw-project-runtime--compare-weather .card-row {
    grid-template-columns: 1fr;
  }
}

/* ─── Forecast metric values ──────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .forecast-values {
  display: flex;
  gap: 2rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.lw-project-runtime--compare-weather .metric {
  display: flex;
  flex-direction: column;
}

.lw-project-runtime--compare-weather .metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  margin-bottom: 0.1rem;
}

.lw-project-runtime--compare-weather .metric-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

/* ─── Comparison note ─────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .comparison-note {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 1rem;
}

/* ─── Chart containers ────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .chart-container {
  position: relative;
  height: 260px;
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .lw-project-runtime--compare-weather .chart-container {
    height: 200px;
  }
}

/* ─── Comparison table ────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.lw-project-runtime--compare-weather .comparison-table th {
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-bottom: 2px solid var(--color-border);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.lw-project-runtime--compare-weather .comparison-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.lw-project-runtime--compare-weather .comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.lw-project-runtime--compare-weather .mean-row td {
  background: color-mix(in srgb, var(--color-border) 40%, transparent);
  border-top: 2px solid var(--color-border);
}

/* ─── Delta colour classes ────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .delta-warm {
  color: var(--color-warm);
  font-weight: 600;
}

.lw-project-runtime--compare-weather .delta-cool {
  color: var(--color-cool);
  font-weight: 600;
}

.lw-project-runtime--compare-weather .delta-neutral {
  color: var(--color-neutral);
}

/* ─── Banner year tags ────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .verdict-warm { color: var(--color-warm); }
.lw-project-runtime--compare-weather .verdict-cool { color: var(--color-cool); }

.lw-project-runtime--compare-weather .year-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.lw-project-runtime--compare-weather .verdict-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  min-width: 6.5rem;
  flex-shrink: 0;
}

.lw-project-runtime--compare-weather .verdict-label-warm { color: var(--color-warm); }
.lw-project-runtime--compare-weather .verdict-label-cool { color: var(--color-cool); }

.lw-project-runtime--compare-weather .year-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

.lw-project-runtime--compare-weather .year-tag small {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.8;
}

.lw-project-runtime--compare-weather .year-tag-warm {
  background: color-mix(in srgb, var(--color-warm) 12%, transparent);
  color: var(--color-warm);
}

.lw-project-runtime--compare-weather .year-tag-cool {
  background: color-mix(in srgb, var(--color-cool) 12%, transparent);
  color: var(--color-cool);
}

.lw-project-runtime--compare-weather .banner-secondary {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ─── Error & empty states ────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather .error-message {
  font-size: 0.875rem;
  color: var(--color-warm);
  padding: 0.75rem 1rem;
  border: 1px solid color-mix(in srgb, var(--color-warm) 30%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--color-warm) 6%, transparent);
  margin-top: 0.5rem;
}

.lw-project-runtime--compare-weather .error-inline {
  color: var(--color-text-muted);
  font-size: 1rem;
  font-weight: 400;
}

.lw-project-runtime--compare-weather .footnote {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}

.lw-project-runtime--compare-weather .chart-empty {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  padding: 2rem 0;
  text-align: center;
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem var(--padding) 2.5rem;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* ─── Diverging temp chart ────────────────────────────────────────────────── */

.lw-project-runtime--compare-weather #today-card {
  background: #f3eae2;
  padding: 0;
  overflow: hidden;
}

.lw-project-runtime--compare-weather #today-card h2,
.lw-project-runtime--compare-weather #today-card .forecast-values,
.lw-project-runtime--compare-weather #today-card .comparison-note,
.lw-project-runtime--compare-weather #today-card #today-table-container {
  display: none;
}

.lw-project-runtime--compare-weather .divtemp-chart {
  width: 100%;
}

.lw-project-runtime--compare-weather .divtemp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 16px 12px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(88, 86, 86, 0.6);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.lw-project-runtime--compare-weather .divtemp-hero {
  padding: 20px 20px 16px;
  background: #f3eae2;
}

.lw-project-runtime--compare-weather .divtemp-hero-temp {
  display: block;
  font-size: 80px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -3px;
  color: #b2a5a0;
  line-height: 1;
}

.lw-project-runtime--compare-weather .divtemp-body {
  display: block;
}

.lw-project-runtime--compare-weather .divtemp-row {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  height: 54px;
}

.lw-project-runtime--compare-weather .divtemp-cool-cell {
  background: #aee1ff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.07);
  overflow: hidden;
  padding-right: 3px;
}

.lw-project-runtime--compare-weather .divtemp-spine {
  background: #373535;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

.lw-project-runtime--compare-weather .divtemp-warm-cell {
  background: #ff6c40;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.07);
  overflow: hidden;
  padding-left: 3px;
}

.lw-project-runtime--compare-weather .divtemp-spine-year {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  user-select: none;
}

.lw-project-runtime--compare-weather .divtemp-bar-cool {
  background: #21a5f1;
  height: 20px;
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 5px;
}

.lw-project-runtime--compare-weather .divtemp-bar-warm {
  background: #fadf75;
  height: 26px;
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 5px;
}

.lw-project-runtime--compare-weather .divtemp-val-in-cool {
  font-size: 13px;
  font-weight: 800;
  color: #1a3a55;
  white-space: nowrap;
  line-height: 1;
}

.lw-project-runtime--compare-weather .divtemp-val-out-cool {
  font-size: 13px;
  font-weight: 800;
  color: #1a3a55;
  white-space: nowrap;
  line-height: 1;
  margin-right: 6px;
  flex-shrink: 0;
}

.lw-project-runtime--compare-weather .divtemp-val-in-warm {
  font-size: 13px;
  font-weight: 800;
  color: #443838;
  white-space: nowrap;
  line-height: 1;
}

.lw-project-runtime--compare-weather .divtemp-val-out-warm {
  font-size: 13px;
  font-weight: 800;
  color: #443838;
  white-space: nowrap;
  line-height: 1;
  margin-left: 6px;
  flex-shrink: 0;
}

.lw-project-runtime--compare-weather .divtemp-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f3eae2;
  font-size: 14px;
  font-weight: 500;
  color: rgba(88, 86, 86, 0.6);
}
