/* ============================================================
   Tracking Teardown — results UI + calculator
   Scoped component asset. Enqueued ONLY on /teardown/ (functions.php).
   Reuses theme :root tokens from style.css (loaded first) — no new tokens,
   no edits to the shared stylesheet. All selectors namespaced `.teardown`.
   Brand: mission-control (navy console + mono labels + LED accents).
   ============================================================ */

/* ---- Console input panel (sits inside .interior-hero) ---- */

.teardown-console {
  max-width: 760px;
  margin: 36px auto 0;
  text-align: left;
}

.teardown-form {
  background: rgba(15, 31, 53, 0.55);
  border: 1px solid rgba(74, 222, 128, 0.18);
  border-radius: var(--radius-card-lg);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-card-hero);
}

.teardown-form__legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-green-verified);
  margin-bottom: 16px;
}

.teardown-field { margin-bottom: 16px; }

.teardown-field__label {
  display: block;
  font-family: var(--font-inter);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 7px;
}

.teardown-field__label .teardown-optional {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-left: 6px;
}

.teardown-input,
.teardown-select {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  padding: 12px 14px;
  font-family: var(--font-source);
  font-size: 16px; /* 16px+ avoids iOS zoom-on-focus */
  color: #FFFFFF;
  background: rgba(13, 27, 46, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-card-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.teardown-input::placeholder { color: rgba(255, 255, 255, 0.35); }

.teardown-input:focus,
.teardown-select:focus {
  outline: none;
  border-color: var(--color-green);
  box-shadow: 0 0 0 3px rgba(50, 133, 80, 0.25);
}

.teardown-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234ADE80' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.teardown-select option { color: #1B3353; background: #FFFFFF; }

.teardown-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Self-styled (theme .btn-primary background is anchor-scoped and won't reach a <button>). */
.teardown-form__submit {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  font-family: var(--font-inter);
  font-size: 17px;
  font-weight: 600;
  color: #FFFFFF;
  background: var(--color-green);
  border: none;
  border-radius: var(--radius-card-sm);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.teardown-form__submit:hover { background: #3a9a5c; transform: translateY(-1px); box-shadow: var(--shadow-btn-glow); }
.teardown-form__submit:disabled { opacity: 0.6; cursor: progress; transform: none; box-shadow: none; }

.teardown-form__hint {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.4);
}

/* ---- Status (loading / error) ---- */

.teardown-status {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 28px auto 0;
  max-width: 760px;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.teardown-status.is-visible { display: flex; }
.teardown-status--error { color: #FCA5A5; }

.teardown-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(74, 222, 128, 0.25);
  border-top-color: var(--color-green-verified);
  border-radius: 50%;
  animation: teardownSpin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes teardownSpin { to { transform: rotate(360deg); } }

/* ============================================================
   Results (JS-rendered into #cc-teardown-results, on .section-light)
   ============================================================ */

/* The whole results section stays collapsed (no empty gray band) until a scan
   completes; JS adds .is-active to the section shell. */
.teardown-results-shell { display: none; }
.teardown-results-shell.is-active { display: block; }

.teardown-results { display: none; }
.teardown-results.is-visible { display: block; }

.teardown-results__inner {
  max-width: 920px;
  margin: 0 auto;
}

/* Neutralize any inherited text-align from a centered content-wrap. */
.teardown-card { text-align: left; }
.teardown-card .teardown-center { text-align: center; }

/* Scanned-URL eyebrow above the readout */
.teardown-readout-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--color-green);
  text-transform: uppercase;
  margin-bottom: 18px;
  word-break: break-all;
}

/* ---- Score card (white, shareable) ---- */

.teardown-card {
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card-lg);
  box-shadow: var(--shadow-card);
  padding: 32px;
}

.teardown-scorecard {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
}

.teardown-dial {
  width: 168px;
  height: 168px;
  flex-shrink: 0;
  position: relative;
}

.teardown-dial svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }

.teardown-dial__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.teardown-dial__num {
  font-family: var(--font-mono);
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  color: #1B3353;
}

.teardown-dial__outof {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-caption);
  margin-top: 4px;
}

.teardown-score-summary__grade {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.teardown-grade--red    { color: var(--color-red-action); background: rgba(234, 28, 28, 0.08); }
.teardown-grade--amber  { color: #B45309; background: rgba(245, 158, 11, 0.12); }
.teardown-grade--green  { color: var(--color-green); background: rgba(50, 133, 80, 0.10); }

.teardown-score-summary__title {
  font-family: var(--font-inter);
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 700;
  color: #1B3353;
  margin: 0 0 8px;
  line-height: 1.25;
}

.teardown-score-summary__text {
  font-family: var(--font-source);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-body);
  margin: 0;
}

/* ---- Loss estimate band ---- */

.teardown-loss {
  margin-top: 20px;
  padding: 26px 28px;
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, #1B3353 0%, #0F1F35 100%);
  color: #FFFFFF;
  text-align: center;
}

.teardown-loss__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 10px;
}

.teardown-loss__figure {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.05;
  color: var(--color-green-verified);
}

.teardown-loss__range {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 38px);
  color: var(--color-green-verified);
}

.teardown-loss__unit { font-size: 0.5em; color: rgba(255, 255, 255, 0.6); font-weight: 400; }

/* Loss-rate semantics (Clint, 2026-06-09): the % range is the ALWAYS-visible hero figure —
   red when more than 10% of conversion signal is estimated lost, green at 10% or less.
   Lower specificity than the --typical amber override below, so the "not your site"
   treatment stays authoritative on failed scans. */
.teardown-loss__range--green { color: var(--color-green-verified); }
.teardown-loss__range--red { color: var(--color-red-action); }

/* Dollar range rides inside the sub paragraph — big but subordinate to the % hero
   (Clint, 2026-06-09: 24pt → "a little smaller" + proper spacing from the sentence). */
.teardown-loss__money {
  display: inline-block;
  margin: 0 10px;
  font-family: var(--font-mono);
  font-size: 20pt;
  font-weight: 700;
  line-height: 1.25;
  color: #FFFFFF;
}

.teardown-loss__sub {
  font-family: var(--font-source);
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  margin: 12px auto 0;
  max-width: 520px;
}

.teardown-loss__basis {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

/* Typical (failed-scan) band: amber figure + a loud "not your site" pill so a shared
   screenshot can never be mistaken for a measurement of the visitor's own site. */
.teardown-loss--typical .teardown-loss__figure,
.teardown-loss--typical .teardown-loss__range { color: var(--color-amber); }

.teardown-loss__pill {
  display: inline-block;
  margin-bottom: 14px;
  padding: 5px 13px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #1B3353;
  background: var(--color-amber);
  border-radius: 999px;
}

/* Honesty pill that travels INSIDE the shareable score card. */
.teardown-directional-pill {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-caption);
}

/* ---- Named problems ---- */

.teardown-problems { margin-top: 24px; }

.teardown-problems__title {
  font-family: var(--font-inter);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-caption);
  margin: 0 0 14px;
}

.teardown-problem {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
}

.teardown-problem__led { margin-top: 5px; flex-shrink: 0; }

.teardown-problem__label {
  font-family: var(--font-inter);
  font-size: 16px;
  font-weight: 600;
  color: #1B3353;
  margin: 0 0 4px;
}

.teardown-problem__detail {
  font-family: var(--font-source);
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-body);
  margin: 0;
}

.teardown-clean {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-source);
  font-size: 16px;
  color: var(--color-green);
  padding: 8px 0;
}

/* ---- Honest-limits notes + methodology ---- */

.teardown-notes {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--color-off-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card-sm);
}

.teardown-notes__item {
  display: flex;
  gap: 8px;
  font-family: var(--font-source);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-caption);
  margin-bottom: 8px;
}

.teardown-notes__item:last-child { margin-bottom: 0; }
.teardown-notes__item::before { content: "›"; color: var(--color-green); flex-shrink: 0; }

.teardown-methodology {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-green);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.teardown-methodology:hover { color: #3a9a5c; }

/* ---- Dual CTA ---- */

.teardown-cta {
  margin-top: 28px;
  text-align: center;
}

.teardown-cta__heading {
  font-family: var(--font-inter);
  font-size: clamp(19px, 2.4vw, 24px);
  font-weight: 700;
  color: #1B3353;
  margin: 0 0 6px;
}

.teardown-cta__sub {
  font-family: var(--font-source);
  font-size: 15px;
  color: var(--color-body);
  margin: 0 0 20px;
}

.teardown-cta__row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.teardown-cta__row .btn-primary,
.teardown-cta__row .btn-ghost { min-height: 48px; display: inline-flex; align-items: center; }

/* ---- Light-gate: email the full report ---- */

.teardown-gate {
  margin-top: 26px;
  padding: 24px;
  border: 1px dashed rgba(50, 133, 80, 0.4);
  border-radius: var(--radius-card);
  background: rgba(50, 133, 80, 0.03);
  text-align: center;
}

.teardown-gate__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-green);
  margin-bottom: 8px;
}

.teardown-gate__title {
  font-family: var(--font-inter);
  font-size: 18px;
  font-weight: 700;
  color: #1B3353;
  margin: 0 0 6px;
}

.teardown-gate__text {
  font-family: var(--font-source);
  font-size: 14px;
  color: var(--color-body);
  margin: 0 auto 16px;
  max-width: 460px;
}

.teardown-gate__form {
  display: flex;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.teardown-gate__input {
  flex: 1 1 240px;
  box-sizing: border-box;
  min-height: 48px;
  padding: 12px 14px;
  font-family: var(--font-source);
  font-size: 16px;
  color: #1B3353;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card-sm);
}

.teardown-gate__input:focus {
  outline: none;
  border-color: var(--color-green);
  box-shadow: 0 0 0 3px rgba(50, 133, 80, 0.15);
}

.teardown-gate__btn {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 12px 24px;
  font-family: var(--font-inter);
  font-size: 16px;
  font-weight: 600;
  color: #FFFFFF;
  background: var(--color-green);
  border: none;
  border-radius: var(--radius-card-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.teardown-gate__btn:hover { background: #3a9a5c; }
.teardown-gate__btn:disabled { opacity: 0.6; cursor: progress; }

.teardown-gate__msg {
  margin: 12px 0 0;
  font-family: var(--font-source);
  font-size: 14px;
  min-height: 1em;
}
.teardown-gate__msg--ok { color: var(--color-green); }
.teardown-gate__msg--err { color: var(--color-red-action); }
.teardown-gate.is-done .teardown-gate__form { display: none; }

/* ============================================================
   Methodology disclosure (on-page, #teardown-methodology)
   ============================================================ */

.teardown-method { max-width: 760px; margin: 24px auto 0; }

.teardown-method__row {
  display: flex;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--color-border);
  text-align: left;
}

.teardown-method__rate {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 22px;
  color: var(--color-green);
  flex: 0 0 70px;
}

.teardown-method__body { flex: 1; }

.teardown-method__name {
  font-family: var(--font-inter);
  font-weight: 600;
  font-size: 16px;
  color: #1B3353;
  margin: 0 0 4px;
}

.teardown-method__src {
  font-family: var(--font-source);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-caption);
  margin: 0;
}

@media (max-width: 768px) {
  .teardown-method__row { flex-direction: column; gap: 4px; }
  .teardown-method__rate { flex-basis: auto; }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
  .teardown-form { padding: 22px 18px 20px; }
  .teardown-form__row { grid-template-columns: 1fr; }
  .teardown-card { padding: 22px 18px; }

  .teardown-scorecard {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 20px;
  }

  .teardown-dial { width: 144px; height: 144px; }
  .teardown-dial__num { font-size: 40px; }
  .teardown-score-summary { text-align: center; }
  .teardown-problem { text-align: left; }

  .teardown-cta__row .btn-primary,
  .teardown-cta__row .btn-ghost { width: 100%; max-width: 320px; justify-content: center; }

  .teardown-gate__form { flex-direction: column; }
  .teardown-gate__btn { width: 100%; }
}
