/* Nimbus — screens.css
 * Per-screen layout and component styles.
 */

/* ========== Home screen (S5 layout spec) ==========
 * Design space 1920x1080, 60px overscan: #screen-home's own box (an
 * `#app > section`) is exactly the 1800x960 usable area the spec calls
 * "x 60-1860, y 60-1020" — so a spec position like "x:60,y:250" becomes
 * "left:0,top:190" below. Absolutely positioned children measure offsets
 * from the section's padding edge, which sits at the section's own outer
 * edge regardless of the section's own padding, so no padding override is
 * needed here. */
#screen-home {
  position: relative;
}

/* Week strip: y 0-170, 7 equal focusable cards, data-wrap="stop" (JS). */
.nb-week {
  position: absolute;
  left: 0;
  top: 0;
  width: 1800px;
  height: 170px;
  display: flex;
  gap: 12px;
}

.nb-week-card {
  flex: 1 1 0;
  min-width: 0;
  background: var(--nb-surface);
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font-size: var(--nb-text-sm);
}

.nb-week-card-day {
  font-weight: 600;
  color: var(--nb-text);
}

.nb-week-card-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 56px;
}

.nb-week-card-temp {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.nb-week-card-max { color: var(--nb-text); font-weight: 600; }
.nb-week-card-min { color: var(--nb-text-dim); }

.nb-week-card-rain {
  font-size: var(--nb-text-xs);
  color: var(--nb-rain);
}

/* Tooltip-like panel for the focused week card's extended_text. Pure overlay
 * (position: absolute, out of flow) over the top of the radar — never
 * shifts the week strip, radar or anything else. */
.nb-week-tip {
  position: absolute;
  left: 0;
  top: 178px;
  width: 770px;
  max-height: 140px;
  overflow: hidden;
  background: rgba(6, 18, 43, 0.94);
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius);
  padding: 14px 18px;
  font-size: var(--nb-text-sm);
  color: var(--nb-text-dim);
  line-height: 1.35;
  z-index: 30;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  pointer-events: none;
}

.nb-week-tip.nb-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Radar: 770x770 hero, at (0,190) in this local space. */
.nb-radar-host {
  position: absolute;
  left: 0;
  top: 190px;
  width: 770px;
  height: 770px;
  background: #404040;
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius);
  overflow: hidden;
}

/* ========== Radar component (js/radar.js) ==========
 * .nb-radar fills its host (a square) with stacked absolutely positioned
 * layers: background, topography, frames, range, locations, marker, chip —
 * in that DOM order (CONTRACTS §6). Frame visibility is opacity-only so
 * playback never repaints anything but compositing. */
.nb-radar {
  position: absolute;
  inset: 0;
}

.nb-radar-layer,
.nb-radar-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -o-object-fit: contain;
     object-fit: contain;
  pointer-events: none;
}

.nb-radar-frame {
  opacity: 0;
  transition: opacity 0.1s linear;
}

.nb-radar-frames {
  position: absolute;
  inset: 0;
}

.nb-radar-marker {
  position: absolute;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  overflow: visible;
}

.nb-radar-marker-dot {
  fill: var(--nb-bolt);
  stroke: var(--nb-bg);
  stroke-width: 1.5;
}

.nb-radar-marker-pulse {
  fill: none;
  stroke: var(--nb-bolt);
  stroke-width: 2;
  opacity: 0.7;
  transform-origin: 12px 12px;
  animation: nb-radar-pulse 1.8s ease-out infinite;
}

@keyframes nb-radar-pulse {
  0%   { transform: scale(0.5); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

.nb-radar-chip {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius-pill);
  padding: 6px 16px;
  font-size: var(--nb-text-xs);
  color: var(--nb-text);
  font-variant-numeric: tabular-nums;
  z-index: 5;
}

/* ETA banner: overlays the radar's top edge, full width, ~110 tall, a
 * semi-opaque scrim. Placeholder content until S7 wires real computeEta();
 * the detail line is replaced by a red warning strip when any are active. */
.nb-eta {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 110px;
  background: linear-gradient(to bottom, rgba(6, 18, 43, 0.90), rgba(6, 18, 43, 0.5));
  padding: 10px 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}

.nb-eta-label {
  font-size: var(--nb-text-md); /* 32px */
  color: var(--nb-text-dim);
  font-weight: 600;
}

.nb-eta-countdown {
  font-size: 64px;
  font-variant-numeric: tabular-nums;
  color: var(--nb-text);
  line-height: 1.05;
}

.nb-eta-countdown.nb-eta-arriving,
.nb-eta-countdown.nb-eta-stopping { color: var(--nb-bolt); }
.nb-eta-countdown.nb-eta-raining { color: var(--nb-rain); }

.nb-eta-detail {
  font-size: var(--nb-text-xs);
  color: var(--nb-text-dim);
}

.nb-eta-warning {
  font-size: var(--nb-text-xs);
  color: var(--nb-danger);
  font-weight: 700;
}

/* Control rail: vertical column, matches the radar's height. */
.nb-controls {
  position: absolute;
  left: 790px;
  top: 190px;
  width: 170px;
  height: 770px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nb-controls .nb-rail-btn {
  flex: 1 1 0;
  min-height: 0;
  padding: 6px;
  font-size: var(--nb-text-xs);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.nb-controls .nb-rail-btn.nb-rail-active {
  background: var(--nb-accent-2);
  border-color: var(--nb-accent);
  color: var(--nb-text);
}

/* Right column: Now card + hourly list, matches the radar's height. */
.nb-right {
  position: absolute;
  left: 980px;
  top: 190px;
  width: 820px;
  height: 770px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nb-now {
  flex: 0 0 150px;
  background: var(--nb-surface);
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.nb-now-main {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex: 0 0 auto;
}

.nb-now-temp {
  font-size: 72px;
  font-weight: 700;
  line-height: 1;
  color: var(--nb-text);
}

.nb-now-feels {
  font-size: var(--nb-text-sm);
  color: var(--nb-text-dim);
  white-space: nowrap;
}

.nb-now-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.nb-now-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--nb-text-sm);
  color: var(--nb-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nb-now-meta {
  font-size: var(--nb-text-xs);
  color: var(--nb-text-dim);
  white-space: nowrap;
}

/* Hourly forecast list: scrolls with the D-pad, no visible scrollbar. */
.nb-hours {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: none;
}

.nb-hours::-webkit-scrollbar { display: none; }

.nb-hour-row {
  flex: 0 0 64px;
  background: var(--nb-surface);
  border: 1px solid var(--nb-border);
  border-radius: 8px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: var(--nb-text-sm);
}

.nb-hour-time {
  flex: 0 0 76px;
  font-weight: 600;
  color: var(--nb-accent);
}

.nb-hour-icon {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nb-hour-temp {
  flex: 0 0 60px;
  text-align: right;
}

.nb-hour-rainpct {
  flex: 0 0 60px;
  text-align: right;
  color: var(--nb-rain);
}

.nb-hour-rainmm {
  flex: 0 0 120px;
  text-align: right;
  font-size: var(--nb-text-xs);
  color: var(--nb-text-dim);
  white-space: nowrap;
}

.nb-hour-wind {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: var(--nb-text-xs);
  color: var(--nb-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status chip: top-right, inside the overscan (i.e. top:0/right:0 of this
 * already-inset section). Decorative only — not focusable, sits above the
 * week strip's last card. */
.nb-status {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--nb-surface);
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius-pill);
  padding: 6px 14px;
  font-size: var(--nb-text-xs);
  color: var(--nb-text-dim);
  z-index: 40;
  pointer-events: none;
}

.nb-status.nb-status-online {
  color: var(--nb-success);
  border-color: var(--nb-success);
}

.nb-status.nb-status-degraded {
  color: var(--nb-warm);
  border-color: var(--nb-warm);
}

.nb-status.nb-status-offline {
  color: var(--nb-danger);
  border-color: var(--nb-danger);
}

/* ========== Radar (full screen) ========== */
#screen-radar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nb-radar-fullscreen {
  width: 100%;
  height: 100%;
  background: #404040;
  border: none;
}

/* ========== History screen ========== */
#screen-history {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nb-tabs {
  display: flex;
  gap: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--nb-border);
}

.nb-tab-content {
  flex: 1;
  min-height: 300px;
}

/* ========== Settings screen ========== */
#screen-settings {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 800px;
}

.nb-settings-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nb-settings-label {
  font-size: var(--nb-text-sm);
  font-weight: 600;
  color: var(--nb-text);
}

.nb-settings-value {
  font-size: var(--nb-text-md);
  color: var(--nb-accent);
}

/* ========== Log screen ========== */
#screen-log {
  font-family: 'Courier New', Courier, monospace;
  font-size: var(--nb-text-xs);
  color: var(--nb-text-dim);
  white-space: pre-wrap;
  word-break: break-all;
}
