/* Area Redesign Digital Twin: scene controls and scene affordances
 * (docs/BRAND_ALIGNMENT_SPEC.md sections 1 and 2).
 *
 * Owned by the stage-2 scene agent. It styles the four things the scene puts on
 * screen itself:
 *   1. the viewpoint buttons  (#viewpointBar, built by js/scene.js)
 *   2. the sun and shadow controls (#sunControls, built by js/scene.js)
 *   3. the existing-building hover tooltip (.scene-tooltip)
 *   4. the redesign deltas card (#deltasPanel, filled by js/redesign.js)
 *
 * Loads after css/app.css, so rules here may extend or override the shared
 * components. The vocabulary is the Neighbourhood DT reference vocabulary:
 * .glass, .seg, button.opt, .ovl, .sunrow, .kv2, .badge and .ptitle, so the two
 * tools read as one product. .ovl / .sunrow / .kv2 are the reference primitives
 * that css/app.css does not carry; .ovl and .sunrow are copied verbatim from the
 * reference, .kv2 is scoped to #deltasPanel so it cannot collide with the panels
 * stage.
 *
 * Dark is the only theme. Every value is a brand token from css/tokens.css. The
 * one exception is the badge tints, which are literal rgba over a token colour:
 * that is the reference's own badge recipe (see .badge in css/app.css), because
 * a tint needs an alpha the token itself does not carry.
 */

/* ---------------- reference primitives app.css does not carry ------------- */

/* an overlay row: a checkbox plus its label (reference: "Sun and shadows") */
.ovl {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ink2);
  margin: 8px 0;
}
.ovl input { accent-color: var(--accent); }

/* a small label with its current value on the right (reference: "Time of day") */
.sunrow {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ink3);
}

/* ---------------- viewpoint buttons (left rail, Zichten panel) ------------
 * Two columns of button.opt, each an inline 15px Lucide icon plus its label.
 * They ship disabled and js/scene.js enables them once the planned blocks are
 * loaded, because a viewpoint is computed from that geometry. button.opt
 * already carries the disabled and the press-feedback rules from app.css.
 *
 * Selector note, here and in .sun-quick below: app.css sets the base padding on
 * `button.opt`, which is specificity (0,1,1). A bare `.vp-btn` (0,1,0) would
 * LOSE to it and the padding below would silently not apply, so the rule stays
 * anchored to its container. Do not "simplify" these selectors. */

#viewpointBar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
#viewpointBar .vp-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 9px 10px;
  font-size: 12.5px;
}
#viewpointBar .vp-btn svg { flex: none; }
#viewpointBar .vp-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- sun and shadow controls (floating footer) ---------------
 * The reference stacks these in a side panel; here they sit in the footer bar,
 * so the row wraps rather than clipping a control off the end. The controls
 * keep the reference's own compact chrome, one step tighter than the panel
 * versions because a footer is a strip, not a column. */

#sunControls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}

.sun-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
}

/* master toggle off: the time controls stay in place but read as inactive */
.sun-main.off .sun-presets,
.sun-main.off .sun-quick,
.sun-main.off .sun-time { opacity: .45; }

/* the shadows checkbox is an .ovl row; in a footer it needs no block margin */
.sun-toggle {
  margin: 0;
  flex: none;
  white-space: nowrap;
  cursor: pointer;
}
.sun-toggle input { margin: 0; flex: none; }

/* date presets: the .seg primitive, tightened for the footer */
.sun-presets { flex: none; }
.sun-presets button {
  padding: 5px 9px;
  font-size: 11.5px;
  white-space: nowrap;
}
.sun-presets button:disabled { cursor: default; }

/* hour slider: the .sunrow label sits above it, as in the reference #sunctl */
.sun-time {
  flex: 1 1 104px;
  min-width: 92px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sun-time .sunrow output { font-variant-numeric: tabular-nums; color: var(--ink2); }
#sun-time {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}
#sun-time:disabled { cursor: default; }

/* hour quick buttons: button.opt, tightened for the footer. .sun-quick-btn is
 * also the hook js/scene.js uses to disable them with the master toggle. */
.sun-quick {
  display: flex;
  gap: 4px;
  flex: none;
}
.sun-quick .sun-quick-btn {
  padding: 4px 8px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sun-quick .sun-quick-btn:disabled { cursor: default; }

/* the caveat that travels with the shadows: visual weergave, massing numbers.
 * It carries its own title with the same text, so a narrow window that has to
 * ellipsis the line never hides the caveat. */
.sun-note {
  font-size: 10.5px;
  color: var(--ink3);
  line-height: 1.5;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- existing-building hover tooltip ------------------------
 * The element carries the shared .glass class (js/scene.js), so it is the same
 * material as every other floating surface; only the geometry is tightened to
 * tooltip scale. */

.scene-tooltip {
  position: absolute;
  z-index: 12;
  pointer-events: none;
  max-width: 280px;
  padding: 5px 9px;
  border-radius: var(--r2);
  color: var(--ink);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------------- redesign deltas card (#deltasPanel) ---------------------
 * The shell gives the card its .glass shell and its position (css/app.css);
 * js/redesign.js fills it. Layout: a .ptitle head, the massing chip on its own
 * row so it is never uppercased by the head, then one .kv2 grid per figure. */

#deltasPanel .ptitle { margin: 0 0 8px; }

#deltasPanel .deltas-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 0;
}

/* group label above a .kv2 grid. Deliberately NOT text-transform:uppercase,
 * unlike .ptitle and h4.sub: these labels carry units and identifiers (kWh,
 * m2, a block name) that must keep the casing they were written in. */
#deltasPanel .dsub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink2);
  line-height: 1.45;
  margin: 13px 0 5px;
}
#deltasPanel .dsub .devid { font-weight: 400; }

#deltasPanel .kv2 {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  font-size: 12.5px;
}
#deltasPanel .kv2 .k { color: var(--ink3); }
#deltasPanel .kv2 .v {
  font-weight: 700;
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* delta chips: the .badge primitive, tinted by direction. The tints match the
 * .chip.ok / .chip.warn / .q-unknown recipes in css/app.css, so a delta chip
 * and a provenance chip are visibly the same object. */
#deltasPanel .badge.delta-good { background: rgba(169,207,75,.17); color: #cfe39a; }
#deltasPanel .badge.delta-bad { background: rgba(255,122,112,.16); color: #ffb0aa; }
#deltasPanel .badge.delta-zero { background: rgba(158,190,232,.10); color: var(--ink3); }
