/*
 * Ask Your Chart.
 *
 * The answer is the page. Everything else — the form, the reasoning, the
 * caveat — is arranged around one sentence, because the whole point of this
 * page is that a reader does not have to assemble the answer themselves.
 *
 * Band classes are ask-band-* rather than the shared is-good / score / badge
 * vocabulary, which cosmic-ref-theme.css force-recolours with !important. That
 * sweep once rendered a maroon score on a maroon background at 1.2:1, so these
 * keep their own names and set both colours explicitly.
 */

.ask-hero__inner {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 900px) {
  .ask-hero__inner {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.ask-lead {
  max-width: 60ch;
  margin: 10px 0 0;
  line-height: 1.55;
}

.ask-lead--muted {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.ask-chart-context {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border: 1px solid var(--border-color, rgba(0, 0, 0, .12));
  border-radius: 12px;
  background: var(--bg-glass, rgba(255, 255, 255, .6));
  font-size: 0.82rem;
}

.ask-chart-context small {
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

/* hidden is set from ask.js; grid would otherwise beat the UA rule. */
.ask-chart-context[hidden],
.ask-chart[hidden],
.ask-answer__window[hidden],
.ask-progress[hidden],
.ask-state[hidden],
.ask-form[hidden],
#ask-answer[hidden] {
  display: none;
}

/* ------------------------------------------------------------------- form */

.ask-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

@media (min-width: 720px) {
  .ask-form {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    align-items: end;
  }
  .ask-field--question { grid-column: 1 / -1; }
  .ask-form__actions { grid-column: 1 / -1; }
}

.ask-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.ask-field label {
  font-weight: 700;
  font-size: 0.82rem;
}

.ask-field input,
.ask-field select {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-color, rgba(0, 0, 0, .2));
  border-radius: 12px;
  background: var(--bg-glass, #fff);
  color: var(--text-primary);
  font: inherit;
}

.ask-field__hint {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.ask-field__hint.is-warning {
  color: var(--accent-maroon, #8C2A3A);
  font-weight: 700;
}

.ask-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.ask-form__note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.ask-feedback {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ask-feedback.is-error {
  color: var(--accent-maroon, #8C2A3A);
  font-weight: 700;
}

.ask-progress {
  margin: 16px 0 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------------- answer */

.ask-answer {
  margin-top: 22px;
  padding: 24px;
  display: grid;
  gap: 16px;
}

.ask-answer__question {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* The sentence the reader came for. Everything else is support. */
.ask-answer__headline {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  line-height: 1.35;
  color: var(--text-primary);
}

.ask-answer__confidence {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ask-answer__agreement {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Both colours stated, never inherited — see the note at the top. */
.ask-band {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ask-band-high {
  background: #1E5B3A;
  color: #FFFFFF;
}

.ask-band-moderate {
  background: #7A5B12;
  color: #FFFFFF;
}

.ask-band-low {
  background: #E6DCC8;
  color: #3A2E18;
}

/* Not a warning colour: an unclear chart is a fact, not a failure. */
.ask-band-unclear {
  background: #4A4A52;
  color: #FFFFFF;
}

.ask-answer__window {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border-color, rgba(0, 0, 0, .12));
  border-radius: 12px;
  background: var(--bg-glass, rgba(255, 255, 255, .55));
}

.ask-answer__window strong {
  font-size: 1.05rem;
}

.ask-answer__window span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ask-answer__because h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.ask-answer__because ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.ask-answer__caveat {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent-gold, #B8860B);
  background: var(--bg-glass, rgba(255, 255, 255, .5));
  font-size: 0.85rem;
  line-height: 1.5;
}

.ask-answer__more {
  margin: 0;
  font-size: 0.85rem;
}

.ask-disclaimer {
  margin: 14px 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.ask-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 24px 0;
}

/* ------------------------------------------------------------------ chart */

/*
 * Colours are set here rather than inherited. cosmic-ref-theme.css sweeps the
 * shared status vocabulary with !important, and a chart that lost its line
 * colour to that sweep would be a blank box — the class names stay ask-* for
 * the same reason the confidence bands do.
 */
.ask-chart {
  margin: 0;
  display: grid;
  gap: 10px;
  /* The area gradient is currentColor, so the whole chart tints from here. */
  color: var(--accent-maroon, #7A1F3D);
}

.ask-chart__plot {
  position: relative;
  width: 100%;
  /*
   * Grid items default to min-width:auto, which is the SVG's own width
   * attribute — so the plot refused to shrink below whatever width it was
   * first drawn at, the ResizeObserver never fired, and a narrow phone got a
   * chart wider than its card instead of a redraw.
   */
  min-width: 0;
}

.ask-chart svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  touch-action: pan-y;
}

.ask-chart svg:focus-visible {
  outline: 2px solid var(--accent-gold, #B8860B);
  outline-offset: 2px;
}

.ask-chart__line {
  stroke: var(--accent-maroon, #7A1F3D);
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.ask-chart__area { stroke: none; }

.ask-chart__window {
  fill: var(--accent-gold, #B8860B);
  opacity: 0.18;
}

.ask-chart__threshold {
  stroke-width: 1;
  stroke-dasharray: 3 5;
  stroke-linecap: round;
  opacity: 0.55;
}

.ask-chart__threshold.is-support { stroke: #1E5B3A; }
.ask-chart__threshold.is-oppose { stroke: #8C2A3A; }

/*
 * A halo, because where these labels land depends on the data: the "against"
 * line sits low, and a chart that spends its last years low would print the
 * word straight through the plot line. Stroking the background behind the
 * glyphs keeps both readable without moving the label somewhere meaningless.
 */
.ask-chart__threshold-label,
.ask-chart__tick {
  /* 12px is the site-wide floor (tests/font-legibility.test.mjs). Axis labels
     are exactly the text people squint at, so it applies here too. */
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  fill: var(--text-secondary, #5A5A5A);
  paint-order: stroke fill;
  stroke: var(--bg-card, #FFFFFF);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.ask-chart__now {
  stroke: var(--text-secondary, #5A5A5A);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  opacity: 0.5;
}

.ask-chart__marker {
  fill: var(--accent-maroon, #7A1F3D);
  stroke: var(--bg-card, #FFFFFF);
  stroke-width: 2.5;
}

/* ------------------------------------------------------- hover and focus */

.ask-chart__hover-line {
  stroke: var(--text-primary, #1A1A1A);
  stroke-width: 1;
  /* Reads as a guide, not a second data series. */
  stroke-opacity: 0.35;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}

.ask-chart__hover-dot {
  fill: var(--bg-card, #FFFFFF);
  stroke: var(--accent-maroon, #7A1F3D);
  stroke-width: 2.5;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}

/* The dot takes the year's own stance, so the readout and the mark agree. */
.ask-chart__hover-dot.is-supports { stroke: #1E5B3A; }
.ask-chart__hover-dot.is-opposes { stroke: #8C2A3A; }

.ask-chart__tip {
  position: absolute;
  transform: translateX(-50%);
  z-index: 2;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--text-primary, #1A1A1A);
  color: #FFFFFF;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

.ask-chart__tip[hidden] { display: none; }

/* Announced to screen readers as the focus moves; never shown on screen. */
.ask-chart__live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ask-chart__caption {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  .ask-chart__hover-line,
  .ask-chart__hover-dot { transition: none; }
}
