/* === Spectral Filtering Widget === */

.widget-root {
  position: relative;
  border-radius: 0 8px 8px 0;
  background: #ffffff;
  border-left: 3px solid #1d3557;
  padding: 24px clamp(18px, 3vw, 28px) 22px;
  margin: 18px auto 28px;
  max-width: 760px;
}

.widget-root.loading {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-style: italic;
}

.widget-error {
  background: #fef2f2;
  color: #991b1b;
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 14px;
}
.widget-error code {
  background: #fee2e2;
  padding: 1px 6px;
  border-radius: 4px;
}

.widget-eyebrow {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1d3557;
  font-weight: 700;
  margin-bottom: 6px;
}
.widget-headline {
  font-family: "Newsreader", "Source Serif Pro", Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  color: #1a1d24;
  letter-spacing: -0.005em;
  line-height: 1.35;
}
.widget-headline .kbd {
  font-family: "JetBrains Mono", "SF Mono", monospace;
  background: #d6e0ec;
  color: #1d3557;
  padding: 1px 9px;
  border-radius: 5px;
  font-size: 17px;
  border: 1px solid #b5c7da;
  font-weight: 600;
}
.widget-sub {
  margin-top: 8px;
  font-size: 14px;
  color: #475569;
  line-height: 1.55;
}
.widget-sub em { font-style: italic; }

.widget-sub .lg-raw,
.widget-sub .lg-mom,
.widget-sub .lg-sig {
  font-weight: 600;
  padding: 0 4px;
  border-radius: 3px;
}
.widget-sub .lg-raw   { color: #6b7280; background: #f1ede4; }
.widget-sub .lg-mom   { color: #1d3557; background: #d6e0ec; }
.widget-sub .lg-sig   { color: #7c2d3a; background: #f5e1e5; }

.widget-charts {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spectrum-chart {
  width: 100%;
  height: 320px;
  display: block;
}
.ratio-chart {
  width: 100%;
  height: 180px;
  display: block;
}
.alignment-chart {
  width: 100%;
  height: 380px;
  display: block;
}

/* Arrow plot — three projection arrows from origin. */
.arrow-line {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.arrow-line.raw {
  stroke: #6b7280;
  stroke-width: 1.6;
  stroke-dasharray: 5 4;
}
.arrow-line.sig {
  stroke: #7c2d3a;
  stroke-width: 2.4;
}
.arrow-line.mom {
  stroke: #1d3557;
  stroke-width: 2.6;
}
.arrow-frame line {
  stroke: #cbd5e1;
  stroke-width: 1;
}
.arrow-frame line.axis {
  stroke: #64748b;
  stroke-width: 1.2;
}
.arrow-frame text {
  font-size: 10.5px;
  fill: #94a3b8;
  font-family: "JetBrains Mono", monospace;
}
.widget-charts text.arrow-label {
  font-size: 12px;
  font-weight: 600;
  font-family: "JetBrains Mono", "SF Mono", monospace;
}
.widget-charts text.arrow-label.raw { fill: #4b5563; }
.widget-charts text.arrow-label.sig { fill: #7c2d3a; }
.widget-charts text.arrow-label.mom { fill: #1d3557; }

.arrow-legend line { fill: none; }

.widget-charts text.axis-label {
  font-size: 11px;
  fill: #475569;
  font-family: "Inter", "Helvetica Neue", sans-serif;
}
.widget-charts text.axis-title {
  font-size: 12px;
  fill: #334155;
  font-family: "Inter", sans-serif;
}
.widget-charts text.band-label,
.widget-charts text.ratio-title {
  font-size: 11px;
  fill: #142647;
  font-style: italic;
}
.widget-charts text.ratio-title {
  fill: #475569;
  font-style: normal;
  font-weight: 500;
}

/* === Controls === */

.widget-controls {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-items: center;
}
.control-row.hero label .lab-name { font-weight: 600; color: #0f172a; }
.control-row.inline {
  flex-direction: row;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.control-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  color: #334155;
}
.lab-name { font-weight: 500; }
.lab-sub  { color: #94a3b8; font-weight: 400; font-size: 12px; margin-left: 6px; }
.lab-val {
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 14px;
  color: #1d3557;
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, #e2e8f0, #e2e8f0);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  margin: 4px 0 0;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #1d3557;
  border: 2.5px solid #ffffff;
  box-shadow: 0 1px 3px rgba(29, 53, 87, 0.35), 0 0 0 1px #b5c7da;
  cursor: grab;
  transition: transform 0.12s ease;
}
.slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
  cursor: grabbing;
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #1d3557;
  border: 2.5px solid #ffffff;
  box-shadow: 0 1px 3px rgba(29, 53, 87, 0.35), 0 0 0 1px #b5c7da;
  cursor: grab;
}

.slider-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: #94a3b8;
  font-family: "JetBrains Mono", monospace;
  margin-top: 2px;
}

.control-mini-label {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}
.control-mini-label.info {
  color: #94a3b8;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.rank-pills {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.pill {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  color: #475569;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}
.pill:hover { color: #1d3557; }
.pill.active {
  background: #ffffff;
  color: #1d3557;
  box-shadow: 0 1px 2px rgba(28, 31, 40, 0.08);
}

.spacer { flex: 1; }

.rank-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.rank-note-sep {
  color: #cbd5e1;
  font-weight: 500;
}
.rank-note {
  font-size: 12.5px;
  color: #142647;
  font-family: "Inter", sans-serif;
  font-style: italic;
}

.widget-charts text.gap-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  fill: #1e293b;
  font-weight: 500;
}

.reset-btn {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.reset-btn:hover { background: #f8fafc; color: #0f172a; }

/* === Readout === */
.widget-readout {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}
.readout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.readout-item .r-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 3px;
}
.readout-item .r-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  color: #0f172a;
  font-weight: 600;
}

@media (max-width: 700px) {
  .widget-root { padding: 22px 16px 18px; border-radius: 12px; }
  .widget-headline { font-size: 17px; }
  .spectrum-chart { height: 260px; }
  .ratio-chart    { height: 150px; }
}
