/*
 * NableU maintainer note
 * Purpose: Styles the bounded Ambient Scene Band and its Expression settings.
 * The scene is atmosphere behind the existing Dashboard shell. It must not
 * move, blur or replace canonical NableU controls. Attention remains its own
 * foreground surface with only restrained scene exposure in desktop layouts.
 */

.dashboard[data-expression-ambient] {
  position: relative;
  isolation: isolate;
}

.dashboard[data-expression-ambient]::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  z-index: -1;
  height: var(--ambient-band-height, 250px);
  background-image:
    linear-gradient(to bottom, transparent 0%, transparent 48%, var(--bg-app) 100%),
    linear-gradient(to bottom, rgba(5, 11, 20, var(--ambient-overlay-top, 0.16)), rgba(5, 11, 20, var(--ambient-overlay-mid, 0.26))),
    var(--ambient-scene-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

/*
 * Attention is foreground chrome, not a boundary for the ambient environment.
 * The scene therefore spans the complete Dashboard shell beneath both the
 * collapsed handle footprint and the expanded rail. Opening Attention changes
 * foreground geometry only; it does not resize or squeeze the scene canvas.
 */
.dashboard[data-expression-ambient] .cognitive-rail {
  background: var(--bg-sidebar);
  background: color-mix(in srgb, var(--bg-sidebar) 94%, transparent);
}

.dashboard[data-expression-ambient] .support-panel-button {
  background: var(--bg-shell);
  background: color-mix(in srgb, var(--bg-shell) 96%, transparent);
}

.dashboard[data-ambient-height="subtle"] {
  --ambient-band-height: 180px;
}

.dashboard[data-ambient-height="medium"] {
  --ambient-band-height: 250px;
}

.dashboard[data-ambient-height="immersive"] {
  --ambient-band-height: 320px;
}

.dashboard[data-ambient-intensity="subtle"] {
  --ambient-overlay-top: 0.34;
  --ambient-overlay-mid: 0.44;
}

.dashboard[data-ambient-intensity="standard"] {
  --ambient-overlay-top: 0.16;
  --ambient-overlay-mid: 0.26;
}

.dashboard[data-ambient-intensity="rich"] {
  --ambient-overlay-top: 0.04;
  --ambient-overlay-mid: 0.10;
}

html[data-theme="dark"] .dashboard[data-expression-ambient]::before {
  filter: saturate(0.88) brightness(0.82);
}

html[data-theme="high-contrast"] .dashboard[data-expression-ambient]::before {
  display: none;
}

.expression-ambient-settings {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.expression-ambient-heading {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.expression-ambient-heading h4 {
  margin: 2px 0 8px;
  font-size: 1.05rem;
}

.expression-ambient-toggle {
  min-width: 210px;
}

.expression-ambient-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.expression-ambient-grid label {
  display: grid;
  gap: 6px;
}

.expression-ambient-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

#ambientBandStatus[data-kind="success"] {
  color: var(--success, #1f7a46);
}

#ambientBandStatus[data-kind="error"] {
  color: var(--danger, #a62c2c);
}

#ambientBandStatus[data-kind="preview"],
#ambientBandStatus[data-kind="busy"] {
  color: var(--text-muted);
}

@media (max-width: 900px) {
  /* The mobile Attention drawer is viewport-fixed; keep it fully opaque. */
  .dashboard[data-expression-ambient] .cognitive-rail {
    background: var(--bg-sidebar);
  }
}

@media (max-width: 720px) {
  .dashboard[data-ambient-height="subtle"] {
    --ambient-band-height: 120px;
  }

  .dashboard[data-ambient-height="medium"] {
    --ambient-band-height: 165px;
  }

  .dashboard[data-ambient-height="immersive"] {
    --ambient-band-height: 205px;
  }

  .expression-ambient-heading,
  .expression-ambient-grid {
    grid-template-columns: 1fr;
  }

  .expression-ambient-toggle {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard[data-expression-ambient]::before {
    transition: none !important;
  }
}
