/* ============================================================
   meteo.css — Mont Gosford · Affichage météo
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;700;800;900&family=DM+Mono:wght@500&display=swap');

:root {
  --bg: #f0f3f7;
  --panel: #ffffff;
  --panel-soft: #e8edf3;
  --text: #0b0d0f;
  --muted: #3a4a58;
  --accent: #0057ff;
  --danger: #c0001e;
  --warning: #d97706;
  --border: #ccd5df;
  --shadow: 0 0.5vw 1.4vw rgba(0, 0, 0, 0.10);
  --radius: 1.1vw;
  --safe: 2vw;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'DM Sans', Arial, sans-serif;
  background: #b8c4d0;
  color: var(--text);
}

body { padding: 1.2vw; }

/* ── Screen frame ─────────────────────────────────────────── */
.screen {
  width: calc(100vw - 2.4vw);
  height: calc(100vh - 2.4vw);
  background: var(--bg);
  border: 0.3vw solid #1a2330;
  box-shadow: 0 0 0 0.7vw #1a2330;
  display: grid;
  grid-template-rows: 9.5vh 1fr 10.5vh;
  overflow: hidden;
  border-radius: 0.6vw;
}

/* ── Top bar ──────────────────────────────────────────────── */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1vw;
  padding: 0 var(--safe);
  background: #ffffff;
  border-bottom: 0.18vw solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9vw;
}

.logo-img {
  height: 4.6vh;
  max-height: 56px;
  width: auto;
  object-fit: contain;
}

/* Fallback si image manquante */
.logo-fallback {
  width: 3.8vw;
  height: 3.8vw;
  min-width: 50px;
  min-height: 50px;
  border-radius: 0.7vw;
  background: #a01e14;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.1vw;
  letter-spacing: 0.04em;
}

.brand-title {
  font-size: 1.95vw;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.brand-subtitle {
  margin-top: 0.3vw;
  font-size: 0.95vw;
  font-weight: 700;
  color: var(--muted);
}

/* Alert ticker ── centre de la topbar */
.alert-ticker-wrap {
  justify-self: center;
  overflow: hidden;
  max-width: 38vw;
}

.alert-ticker {
  display: flex;
  gap: 3vw;
  animation: ticker-scroll 18s linear infinite;
  white-space: nowrap;
}

.alert-ticker:hover { animation-play-state: paused; }

.alert-item {
  font-size: 1.05vw;
  font-weight: 800;
  padding: 0.5vw 1.1vw;
  border-radius: 999px;
  white-space: nowrap;
}

.alert-item.info    { background: #e8f0ff; color: #003cad; border: 0.15vw solid #b8cdfd; }
.alert-item.warning { background: #fff4e0; color: #92500a; border: 0.15vw solid #f0c878; }
.alert-item.danger  { background: #ffe8ea; color: var(--danger); border: 0.15vw solid #f5b0b8; }
.alert-item.snow    { background: #edf4ff; color: #0050cc; border: 0.15vw solid #b3d0ff; }

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.datetime {
  justify-self: end;
  text-align: right;
}

.clock {
  font-family: 'DM Mono', monospace;
  font-size: 2.2vw;
  font-weight: 500;
  line-height: 1;
}

.date {
  margin-top: 0.35vw;
  font-size: 0.95vw;
  font-weight: 700;
  color: var(--muted);
}

/* ── Main content ─────────────────────────────────────────── */
.content {
  display: grid;
  grid-template-columns: 57% 43%;
  gap: 1.1vw;
  padding: 1.1vw;
  overflow: hidden;
}

/* Panels shared style */
.camera-panel,
.weather-panel,
.forecast-panel,
.partners {
  background: var(--panel);
  border: 0.15vw solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Camera / Webcam ──────────────────────────────────────── */
.camera-panel {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.camera-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.camera-info {
  position: absolute;
  left: 1.1vw;
  right: 1.1vw;
  bottom: 1.1vw;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1vw;
  z-index: 2;
}

.camera-caption {
  background: rgba(255,255,255,0.88);
  border: 0.15vw solid rgba(11,13,15,0.12);
  border-radius: 0.8vw;
  padding: 0.8vw 1vw;
}

.camera-title {
  font-size: 1.2vw;
  font-weight: 900;
  line-height: 1.1;
}

.camera-meta {
  margin-top: 0.25vw;
  font-size: 0.9vw;
  font-weight: 700;
  color: var(--muted);
}

/* Heure de dernière mise à jour image */
.refresh-badge {
  background: rgba(255,255,255,0.92);
  border: 0.15vw solid var(--border);
  border-radius: 999px;
  padding: 0.65vw 1vw;
  font-size: 0.88vw;
  font-weight: 900;
  white-space: nowrap;
  font-family: 'DM Mono', monospace;
}

/* ── Right column ─────────────────────────────────────────── */
.right-column {
  display: grid;
  grid-template-rows: 55% 45%;
  gap: 1.1vw;
  min-height: 0;
}

/* ── Weather panel ────────────────────────────────────────── */
.weather-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 1.1vw;
  min-height: 0;
  gap: 0.5vw;
}

.section-title {
  font-size: 0.9vw;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-subtitle {
  font-size: 1vw;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.8;
  font-family: 'DM Mono', monospace;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5vw;
}

.weather-main {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1vw;
  align-items: center;
  min-height: 0;
}

.temp-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
}

.temp {
  font-size: 7.4vw;
  line-height: 0.9;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.condition {
  margin-top: 0.4vw;
  font-size: 1.2vw;
  font-weight: 800;
  color: var(--accent);
}

.metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6vw;
}

.metric {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  background: var(--panel-soft);
  border: 0.13vw solid #d5dde6;
  border-radius: 0.8vw;
  padding: 0.65vw 0.9vw;
}

.metric-label {
  font-size: 1.05vw;
  font-weight: 800;
  color: var(--muted);
}

.metric-value {
  font-size: 1.4vw;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
  font-family: 'DM Mono', monospace;
}

/* Wind direction badge */
.wind-dir {
  display: inline-block;
  font-size: 0.85vw;
  font-weight: 900;
  background: var(--accent);
  color: #fff;
  border-radius: 0.4vw;
  padding: 0.1vw 0.4vw;
  margin-right: 0.3vw;
  vertical-align: middle;
  font-family: 'DM Mono', monospace;
}

/* Snow metric avec Δ24h */
.metric-sub {
  grid-column: 1 / -1;
  font-size: 0.78vw;
  font-weight: 700;
  color: var(--muted);
  margin-top: -0.2vw;
  padding: 0 0.2vw;
}

.metric-sub .delta-pos { color: #0057ff; }
.metric-sub .delta-neg { color: var(--danger); }

/* ── Forecast panel ───────────────────────────────────────── */
.forecast-panel {
  padding: 1.1vw;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  gap: 0.5vw;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.7vw;
  align-items: stretch;
  min-height: 0;
}

.forecast-day {
  background: var(--panel-soft);
  border: 0.13vw solid #d5dde6;
  border-radius: 0.85vw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 0.8vw 0.4vw;
  text-align: center;
  transition: background 0.2s;
}

.forecast-day.today { border-color: var(--accent); background: #edf3ff; }

.forecast-name {
  font-size: 0.88vw;
  font-weight: 900;
  line-height: 1.1;
}

.forecast-icon {
  font-size: 2.1vw;
  line-height: 1;
  margin: 0.3vw 0;
}

.forecast-temp {
  font-size: 1vw;
  font-weight: 900;
  line-height: 1.1;
  font-family: 'DM Mono', monospace;
}

.forecast-extra {
  margin-top: 0.3vw;
  font-size: 0.76vw;
  font-weight: 700;
  color: var(--muted);
}

.forecast-extra.alert { color: var(--danger); }
.forecast-extra.snow  { color: #0050cc; }

/* ── Bottom bar / Partners ────────────────────────────────── */
.bottombar {
  padding: 0 1.1vw 1.1vw;
  background: transparent;
}

.partners {
  height: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1vw;
  padding: 0 1.2vw;
}

.partners-title {
  font-size: 0.9vw;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.partners-logos {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 1vw;
  overflow: hidden;
}

.partner-logo {
  height: 4.2vh;
  min-height: 28px;
  padding: 0.5vw 1vw;
  border: 0.13vw solid #d5dde6;
  border-radius: 0.75vw;
  background: #f6f9fc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95vw;
  font-weight: 900;
  color: #1f2933;
  white-space: nowrap;
}

.partner-logo img {
  height: 100%;
  width: auto;
  object-fit: contain;
}

/* ── Source label (Environnement Canada / Gaétan) ─────────── */
.source-badge {
  display: inline-block;
  font-size: 0.72vw;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15vw 0.55vw;
  border-radius: 0.4vw;
  vertical-align: middle;
  margin-left: 0.4vw;
}

.source-badge.canada { background: #e8f0ff; color: #003cad; }
.source-badge.gaetan { background: #e8f5e9; color: #1b5e20; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-aspect-ratio: 16/10) {
  .content { grid-template-columns: 54% 46%; }
  .temp    { font-size: 6.8vw; }
}
