/* cv04.css — Cornerstone Insurance Homeowners Insurance (A6 Risk Scenario Simulator)
   Scoped strictly to .cv04-* | Inland Piedmont Architectural Blueprint | WCAG 2.2 AA | Zero CLS */

.cv04-sim {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  min-width: 0;
}

.cv04-blueprint-frame {
  background: #FFFFFF;
  border: 2px solid var(--cv-navy, #0A1A33);
  border-radius: 10px;
  box-shadow: var(--cv-shadow, 0 2px 4px rgba(10, 26, 51, 0.05), 0 16px 36px -18px rgba(10, 26, 51, 0.2));
  overflow: hidden;
  min-width: 0;
}

.cv04-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 380;
  background: #0A1A33;
  overflow: hidden;
}

.cv04-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Declarative ON/OFF Protection Layer Visibility (Zero Layout Shift) */
.cv04-on-el,
.cv04-off-el {
  transition: opacity 0.24s ease;
}

.cv04-sim[data-layer-dwelling="on"] .cv04-layer-dwelling .cv04-on-el,
.cv04-sim[data-layer-property="on"] .cv04-layer-property .cv04-on-el,
.cv04-sim[data-layer-ale="on"] .cv04-layer-ale .cv04-on-el,
.cv04-sim[data-layer-liability="on"] .cv04-layer-liability .cv04-on-el {
  opacity: 1;
}

.cv04-sim[data-layer-dwelling="on"] .cv04-layer-dwelling .cv04-off-el,
.cv04-sim[data-layer-property="on"] .cv04-layer-property .cv04-off-el,
.cv04-sim[data-layer-ale="on"] .cv04-layer-ale .cv04-off-el,
.cv04-sim[data-layer-liability="on"] .cv04-layer-liability .cv04-off-el {
  opacity: 0;
  pointer-events: none;
}

.cv04-sim[data-layer-dwelling="off"] .cv04-layer-dwelling .cv04-on-el,
.cv04-sim[data-layer-property="off"] .cv04-layer-property .cv04-on-el,
.cv04-sim[data-layer-ale="off"] .cv04-layer-ale .cv04-on-el,
.cv04-sim[data-layer-liability="off"] .cv04-layer-liability .cv04-on-el {
  opacity: 0;
  pointer-events: none;
}

.cv04-sim[data-layer-dwelling="off"] .cv04-layer-dwelling .cv04-off-el,
.cv04-sim[data-layer-property="off"] .cv04-layer-property .cv04-off-el,
.cv04-sim[data-layer-ale="off"] .cv04-layer-ale .cv04-off-el,
.cv04-sim[data-layer-liability="off"] .cv04-layer-liability .cv04-off-el {
  opacity: 1;
}

/* GPU-Composited Blueprint Motion (Runs Only When Visible & Unpaused) */
@keyframes cv04-sweep {
  0% { transform: translateX(-140px); }
  100% { transform: translateX(1020px); }
}

@keyframes cv04-dash {
  to { stroke-dashoffset: -32; }
}

@keyframes cv04-hail-drop {
  0%, 100% { transform: translateY(0); opacity: 0.92; }
  50% { transform: translateY(5px); opacity: 0.45; }
}

.cv04-scanbar,
.cv04-hail-arc,
.cv04-ale-line,
.cv04-liab-arc,
.cv04-hail {
  animation-play-state: paused;
}

.cv04-sim.cv04-motion-live .cv04-scanbar {
  animation: cv04-sweep 9.5s linear infinite;
  animation-play-state: running;
}

.cv04-sim.cv04-motion-live .cv04-hail-arc,
.cv04-sim.cv04-motion-live .cv04-ale-line,
.cv04-sim.cv04-motion-live .cv04-liab-arc {
  animation: cv04-dash 3.4s linear infinite;
  animation-play-state: running;
}

.cv04-sim.cv04-motion-live .cv04-hail {
  animation: cv04-hail-drop 2.2s ease-in-out infinite;
  animation-play-state: running;
}

/* 4-Switch Architectural Rocker Deck */
.cv04-switch-deck {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  background: var(--cv-fog, #EFF2F5);
  border-top: 2px solid var(--cv-navy, #0A1A33);
}

.cv04-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 58px;
  min-width: 44px;
  padding: 0.65rem 0.8rem;
  border: 2px solid #1C4A75;
  border-left: 5px solid #2E72AC;
  border-radius: 8px;
  background: #FFFFFF;
  color: #0A1A33;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.cv04-toggle:hover {
  background: #F4F8FC;
  box-shadow: 0 4px 12px -6px rgba(10, 26, 51, 0.28);
}

.cv04-toggle.is-off {
  background: #FEF1EA;
  border-color: #B5420B;
  border-left-color: #F26822;
}

.cv04-toggle-meta {
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
  min-width: 0;
}

.cv04-toggle-code {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1C4A75;
}

.cv04-toggle.is-off .cv04-toggle-code {
  color: #B5420B;
}

.cv04-toggle-name {
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  color: #0A1A33;
}

.cv04-rocker {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 56px;
  height: 28px;
  padding: 0 5px;
  border-radius: 6px;
  background: #1C4A75;
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  transition: background-color 0.2s ease;
}

.cv04-rocker-knob {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: #FFFFFF;
  transition: transform 0.2s ease;
}

.cv04-toggle.is-off .cv04-rocker {
  flex-direction: row-reverse;
  background: #F26822;
  color: #0A1A33;
}

.cv04-toggle.is-off .cv04-rocker-knob {
  background: #0A1A33;
}

/* Live Protection Score Bar & Plain-English Gap Readout */
.cv04-status-panel {
  background: #FFFFFF;
  border: 1.5px solid rgba(10, 26, 51, 0.2);
  border-left: 6px solid #1C4A75;
  border-radius: 8px;
  padding: clamp(1.1rem, 2.4vw, 1.55rem);
  box-shadow: var(--cv-shadow, 0 2px 4px rgba(10, 26, 51, 0.05), 0 16px 36px -18px rgba(10, 26, 51, 0.2));
  min-width: 0;
}

.cv04-status-panel[data-level="warn"] {
  border-left-color: #F26822;
}

.cv04-status-panel[data-level="critical"] {
  border-left-color: #B5420B;
}

.cv04-score-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.cv04-score-head {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.cv04-keystone {
  display: inline-block;
  width: 16px;
  height: 14px;
  background: linear-gradient(180deg, #0A1A33 0 3px, transparent 3px 5px, #2E72AC 5px 8px, transparent 8px 10px, #F26822 10px 14px);
  flex: 0 0 auto;
}

.cv04-score-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #475569;
}

.cv04-score-val {
  font-size: 0.94rem;
  font-weight: 800;
  color: #0A1A33;
}

.cv04-reset {
  min-height: 44px;
  min-width: 44px;
  padding: 0.45rem 0.95rem;
  border: 2px solid #0A1A33;
  border-radius: 6px;
  background: #F26822;
  color: #0A1A33;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.cv04-reset:hover {
  background: #0A1A33;
  color: #FFFFFF;
}

.cv04-meter {
  width: 100%;
  height: 12px;
  border-radius: 4px;
  background: #E2E8F0;
  overflow: hidden;
  margin-bottom: 1rem;
}

.cv04-meter-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, #1C4A75 0%, #2E72AC 65%, #579CCD 100%);
  transition: transform 0.28s ease;
}

.cv04-status-panel[data-level="warn"] .cv04-meter-fill,
.cv04-status-panel[data-level="critical"] .cv04-meter-fill {
  background: linear-gradient(90deg, #B5420B 0%, #F26822 100%);
}

.cv04-pill-state {
  display: inline-flex;
  align-items: center;
  padding: 0.26rem 0.7rem;
  border-radius: 4px;
  background: #E8F2FA;
  border: 1px solid rgba(28, 74, 117, 0.28);
  color: #1C4A75;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.cv04-status-panel[data-level="warn"] .cv04-pill-state,
.cv04-status-panel[data-level="critical"] .cv04-pill-state {
  background: #FEF1EA;
  border-color: rgba(181, 66, 11, 0.35);
  color: #B5420B;
}

.cv04-readout-heading {
  margin: 0 0 0.45rem;
  font-size: clamp(1.08rem, 2vw, 1.32rem);
  font-weight: 800;
  line-height: 1.24;
  color: #0A1A33;
}

.cv04-readout-copy {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.58;
  color: #334155;
  max-width: 72ch;
}

.cv04-gap-list {
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.cv04-gap-item {
  background: #FEF1EA;
  border: 1px solid rgba(181, 66, 11, 0.28);
  border-left: 4px solid #F26822;
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  font-size: 0.86rem;
  line-height: 1.48;
  color: #0A1A33;
}

.cv04-gap-item strong {
  display: block;
  margin-bottom: 0.16rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #B5420B;
}

/* Responsive Breakpoints (Zero Overflow at 390px) */
@media (max-width: 980px) {
  .cv04-switch-deck {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .cv04-gap-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .cv04-switch-deck {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.75rem;
  }
}
