/* ==========================================================================
   wx-components.css  —  Weather Dashboard component styles
   Phase 0 scaffolding. V1 — 2026-07-11.

   Reads only from wx-tokens.css. No hard-coded colours here — if a value is
   missing, add a token, don't inline a hex. Component classes mirror the
   patterns in the standalone dashboard (cards pinned over site art, sensor
   chips, segmented controls, forecast/camera panels) so Phase 3+ can drop
   markup straight onto these classes.

   Load order on every page:  wx-tokens.css  ->  wx-components.css
   Deploy name on server: css/wx-components.css
   ========================================================================== */

/* ---- Reset / base ------------------------------------------------------ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--wx-bg);
  color: var(--wx-text);
  font-family: var(--wx-font);
  font-size: var(--wx-fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--wx-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wx-shell { max-width: var(--wx-maxw); margin: 0 auto; padding: var(--wx-sp-6) var(--wx-sp-5); }

/* ---- Card -------------------------------------------------------------- */
.wx-card {
  background: var(--wx-surface);
  border: 1px solid var(--wx-border);
  border-radius: var(--wx-radius-lg);
  box-shadow: var(--wx-shadow-card);
  padding: var(--wx-sp-4);
}
.wx-card--flush { padding: 0; overflow: hidden; }
.wx-card__title {
  font-size: var(--wx-fs-md);
  font-weight: var(--wx-fw-semibold);
  color: var(--wx-text);
  margin-bottom: var(--wx-sp-3);
}
.wx-card__label {
  font-size: var(--wx-fs-xs);
  font-weight: var(--wx-fw-medium);
  color: var(--wx-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---- Site art stage (cards pin over background art) -------------------- */
.wx-stage {
  position: relative;
  width: 100%;
  border-radius: var(--wx-radius-xl);
  overflow: hidden;
  background: var(--wx-surface-3) center/cover no-repeat;
}
.wx-stage__art { display: block; width: 100%; height: auto; }
/* card_x / card_y are applied inline as left/top % by the renderer */
.wx-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--wx-border);
  border-radius: var(--wx-radius-md);
  box-shadow: var(--wx-shadow-raised);
  padding: var(--wx-sp-2) var(--wx-sp-3);
  font-size: var(--wx-fs-sm);
  white-space: nowrap;
}
.wx-pin__dot {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--wx-dot);
  border: 2.5px solid #fff;
  box-shadow: var(--wx-shadow-dot);
}

/* ---- Sensor chip ------------------------------------------------------- */
.wx-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--wx-sp-2);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--wx-fs-sm);
  font-weight: var(--wx-fw-medium);
  padding: var(--wx-sp-2) var(--wx-sp-3);
  border-radius: var(--wx-radius-pill);
  background: var(--wx-surface);
  border: 1px solid var(--wx-border);
  color: var(--wx-text-muted);
  transition: all var(--wx-transition);
}
.wx-chip.is-active {
  background: var(--wx-accent-soft);
  border-color: var(--wx-accent);
  color: var(--wx-text);
}
.wx-chip__swatch { width: 9px; height: 9px; border-radius: 50%; }

/* ---- Segmented control (period / unit toggles) ------------------------ */
.wx-seg { display: inline-flex; background: var(--wx-surface-3);
  border: 1px solid var(--wx-border); border-radius: var(--wx-radius-md); padding: 2px; }
.wx-seg__btn {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: var(--wx-fs-sm); font-weight: var(--wx-fw-medium);
  color: var(--wx-text-muted); padding: 6px 11px; border-radius: var(--wx-radius-sm);
  transition: all var(--wx-transition);
}
.wx-seg__btn.is-active {
  background: var(--wx-surface); color: var(--wx-text); box-shadow: var(--wx-shadow-sm);
}

/* ---- Buttons ----------------------------------------------------------- */
.wx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--wx-sp-2);
  font-family: inherit; font-size: var(--wx-fs-md); font-weight: var(--wx-fw-semibold);
  border: none; border-radius: var(--wx-radius-md); padding: 12px var(--wx-sp-5);
  cursor: pointer; color: #fff; background: var(--wx-accent-strong);
  transition: opacity .15s;
}
.wx-btn:disabled { opacity: .45; cursor: not-allowed; }
.wx-btn--ghost { background: var(--wx-surface); color: var(--wx-text);
  border: 1px solid var(--wx-border); }

/* ---- Form fields ------------------------------------------------------- */
.wx-input {
  width: 100%; font-family: inherit; font-size: var(--wx-fs-md); color: var(--wx-text);
  background: var(--wx-surface); border: 1px solid var(--wx-border);
  border-radius: var(--wx-radius-md); padding: 10px var(--wx-sp-3);
}
.wx-input:focus { outline: none; border-color: var(--wx-accent);
  box-shadow: 0 0 0 3px var(--wx-accent-soft); }
.wx-field { display: flex; flex-direction: column; gap: var(--wx-sp-1); }
.wx-field > label { font-size: var(--wx-fs-xs); font-weight: var(--wx-fw-medium);
  color: var(--wx-text-muted); }

/* ---- Metric value display --------------------------------------------- */
.wx-metric { font-variant-numeric: tabular-nums; }
.wx-metric__value { font-size: var(--wx-fs-xl); font-weight: var(--wx-fw-semibold);
  color: var(--wx-text); }
.wx-metric__unit { font-size: var(--wx-fs-sm); color: var(--wx-text-muted); }

/* ---- Status pills ------------------------------------------------------ */
.wx-status { display: inline-flex; align-items: center; gap: var(--wx-sp-1);
  font-size: var(--wx-fs-xs); font-weight: var(--wx-fw-medium);
  padding: 2px var(--wx-sp-2); border-radius: var(--wx-radius-pill); }
.wx-status--ok    { color: var(--wx-good);  background: rgba(61,154,99,0.10); }
.wx-status--warn  { color: var(--wx-warn);  background: rgba(224,165,63,0.10); }
.wx-status--alert { color: var(--wx-alert-ink); background: rgba(255,138,128,0.16); }

/* ---- Chart frame ------------------------------------------------------- */
.wx-chart { position: relative; width: 100%; height: 320px; }
.wx-chart canvas { width: 100% !important; height: 100% !important; }

/* ---- Forecast + camera panels (structure only for now) ---------------- */
.wx-forecast { display: flex; gap: var(--wx-sp-3); overflow-x: auto; }
.wx-forecast__day { flex: 0 0 auto; text-align: center; min-width: 76px;
  padding: var(--wx-sp-3); border-radius: var(--wx-radius-md);
  background: var(--wx-surface-3); }
.wx-camera { border-radius: var(--wx-radius-lg); overflow: hidden;
  background: var(--wx-surface-3); }
.wx-camera__img { display: block; width: 100%; height: auto; }
.wx-camera__stamp { font-size: var(--wx-fs-xs); color: var(--wx-text-muted);
  padding: var(--wx-sp-2) var(--wx-sp-3); }

/* ---- Grid helper ------------------------------------------------------- */
.wx-grid { display: grid; gap: var(--wx-sp-4);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---- Utility ----------------------------------------------------------- */
.wx-muted { color: var(--wx-text-muted); }
.wx-faint { color: var(--wx-text-faint); }
.wx-mono  { font-family: var(--wx-font-mono); }
