/* ------------------------------------------------------------------
   Website speed checker page
   Layered on top of css/styles.css and css/lead-dialog.css
   ------------------------------------------------------------------ */

.speed-hero {
  padding: clamp(3.5rem, 7vw, 5.5rem) 0 clamp(2rem, 4vw, 3rem);
}
.speed-hero-inner { max-width: 760px; }
.speed-hero h1 { margin-bottom: 0.6rem; }
.speed-hero .lead { max-width: 60ch; margin-bottom: 2rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.speed-form { max-width: 640px; }
.speed-input-row {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}
.speed-url-field { flex: 1; margin-bottom: 0; }
.speed-url-field input {
  font: inherit;
  font-family: var(--font-body);
  color: var(--cream);
  background: rgba(22, 17, 15, 0.6);
  border: 1.5px solid rgba(244, 239, 230, 0.15);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  min-height: 48px;
  width: 100%;
  transition: border-color 0.2s, background 0.2s;
}
.speed-url-field input:focus-visible {
  outline: none;
  border-color: var(--orange);
  background: rgba(22, 17, 15, 0.85);
  box-shadow: 0 0 0 3px rgba(245, 115, 27, 0.25);
}
.speed-input-row .btn { white-space: nowrap; }

@media (max-width: 520px) {
  .speed-input-row { flex-direction: column; }
}

/* ---- Results ---- */
.speed-results {
  padding-top: clamp(1rem, 2vw, 1.5rem);
}
.speed-status {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0.8rem 1rem;
  background: rgba(107, 107, 245, 0.08);
  border: 1px solid rgba(107, 107, 245, 0.25);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}
.speed-status.is-done { display: none; }

.speed-results-grid {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  grid-template-areas:
    "main    metrics"
    "mini    metrics"
    "opps    opps"
    "cta     cta";
  gap: 1.2rem;
}
.speed-score-main       { grid-area: main; }
.speed-metrics-card     { grid-area: metrics; }
.speed-mini-scores      { grid-area: mini; }
.speed-opportunities-card { grid-area: opps; }
.speed-cta-card         { grid-area: cta; }

@media (max-width: 820px) {
  .speed-results-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "metrics"
      "mini"
      "opps"
      "cta";
  }
}

.speed-score-card,
.speed-metrics-card,
.speed-mini-scores,
.speed-opportunities-card,
.speed-cta-card {
  background: rgba(244, 239, 230, 0.04);
  border: 1px solid rgba(244, 239, 230, 0.1);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 1.8rem);
}

.speed-score-label,
.speed-sub-label {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--peri);
  margin-bottom: 1rem;
}

.speed-score-card { text-align: center; }
.speed-score-ring {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 1rem;
}
.speed-score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.speed-ring-bg {
  fill: none;
  stroke: rgba(244, 239, 230, 0.1);
  stroke-width: 7;
}
.speed-ring-fg {
  fill: none;
  stroke: #6edc8e;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 289.03;
  stroke-dashoffset: 289.03;
  transition: stroke-dashoffset 0.9s ease, stroke 0.3s;
}
.speed-score-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 3rem;
  color: var(--cream);
}
/* colour the ring based on score band (set via data-score on parent) */
.speed-score-ring[data-score="poor"]   .speed-ring-fg { stroke: #ff6a6a; }
.speed-score-ring[data-score="poor"]   .speed-score-value { color: #ff8a8f; }
.speed-score-ring[data-score="mid"]    .speed-ring-fg { stroke: #ffbf47; }
.speed-score-ring[data-score="mid"]    .speed-score-value { color: #ffd27a; }
.speed-score-ring[data-score="good"]   .speed-ring-fg { stroke: #6edc8e; }
.speed-score-ring[data-score="good"]   .speed-score-value { color: #9fe8b3; }

.speed-score-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.speed-metrics {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}
.speed-metrics li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(244, 239, 230, 0.08);
}
.speed-metrics li:last-child { border-bottom: none; padding-bottom: 0; }
.speed-metric-name {
  color: var(--cream);
  font-weight: 600;
  font-family: var(--font-head);
  font-size: 0.95rem;
}
.speed-metric-value {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--cream);
  text-align: right;
}
.speed-metric-value.is-good { color: #9fe8b3; }
.speed-metric-value.is-mid  { color: #ffd27a; }
.speed-metric-value.is-poor { color: #ff8a8f; }
.speed-metric-detail {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
}

.speed-mini-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}
.speed-mini-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.8rem;
  background: rgba(22, 17, 15, 0.4);
  border-radius: 10px;
}
.speed-mini-list span { color: var(--muted); font-size: 0.9rem; }
.speed-mini-list strong {
  font-family: var(--font-head);
  font-size: 1.1rem;
  color: var(--cream);
}
.speed-mini-list strong.is-good { color: #9fe8b3; }
.speed-mini-list strong.is-mid  { color: #ffd27a; }
.speed-mini-list strong.is-poor { color: #ff8a8f; }

.speed-opportunities {
  list-style: decimal;
  padding-left: 1.4rem;
  margin: 0;
  display: grid;
  gap: 0.9rem;
}
.speed-opportunities li { color: var(--cream); line-height: 1.5; }
.speed-opportunities li strong {
  display: block;
  margin-bottom: 0.2rem;
}
.speed-opportunities li .speed-savings {
  color: var(--orange);
  font-size: 0.85rem;
  font-weight: 600;
}
.speed-opportunities-empty {
  color: var(--muted);
  font-style: italic;
}

.speed-cta-card {
  background: linear-gradient(135deg, rgba(245, 115, 27, 0.12), rgba(107, 107, 245, 0.1));
  border-color: rgba(245, 115, 27, 0.25);
  text-align: center;
}
.speed-cta-card h2 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); margin-bottom: 0.5rem; }
.speed-cta-card p { color: var(--muted); margin-bottom: 1.2rem; max-width: 54ch; margin-inline: auto; }

.speed-error {
  background: rgba(229, 72, 77, 0.08);
  border: 1px solid rgba(229, 72, 77, 0.3);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
  color: var(--cream);
}
.speed-error h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: #ff8a8f; }
.speed-error p { color: var(--muted); }

/* ---- "Why this matters" cream band ---- */
.speed-why { text-align: center; }
.speed-why .container { max-width: 720px; }
.speed-why p { color: #4a3f36; }
.speed-why a { color: var(--orange); font-weight: 600; }
