/* ==========================================================================
   The free website checker (website-checker.html, tools/checker/build.py,
   scripts/modules/checker.js). One white panel under the head, as the
   service pages' illustration panel sits: the address field, then while it
   works a short list of steps and a running bar, then the results: Google's
   four scores as rings, speed numbers and the biggest fixes, every check
   grouped with a drawn mark (blue tick, amber dash, red cross) and its fix,
   and a call to get it fixed.
   ========================================================================== */

.chk {
  padding: clamp(40px, 7vh, 80px) var(--gutter) 0;
}

/* Parts toggled with the hidden attribute have display rules of their own, which would win. */
.chk [hidden] {
  display: none !important;
}

.chk__steps,
.chk__metrics,
.chk__fixes,
.chk__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chk__panel {
  display: grid;
  gap: clamp(28px, 4vh, 44px);
  padding: clamp(20px, 3.2vw, 48px);
  border-radius: clamp(16px, 1.6vw, 24px);
  background: var(--white);
  box-shadow: var(--shadow-lift);
}

.js .chk[data-enter] {
  animation: doc-rise 1000ms var(--ease-out) both;
  animation-delay: calc(80ms + var(--e, 0) * 70ms);
}

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

.chk__form {
  display: grid;
  gap: 12px;
}

.chk__label {
  color: var(--text-mute);
}

.chk__field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px clamp(16px, 2vw, 26px);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bone);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.chk__field:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgb(17 17 17 / 0.08);
}

.chk__field input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: clamp(1.125rem, 0.95rem + 0.8vw, 1.625rem);
  letter-spacing: -0.02em;
  color: var(--ink);
  outline: none;
}

.chk__field input::placeholder {
  color: rgb(17 17 17 / 0.32);
}

.chk__go {
  flex: none;
}

.chk__hint {
  max-width: 64ch;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--text-mute);
}

.chk__error {
  font-size: 0.9375rem;
  line-height: 1.45;
  color: #b3261e;
}

.chk.is-busy .chk__form {
  opacity: 0.5;
  pointer-events: none;
}

/* ------------------------------------------------------------------ while it works */

.chk__loading {
  display: grid;
  gap: 16px;
}

.chk__loading-title {
  font-size: clamp(1.25rem, 0.95rem + 1vw, 1.75rem);
  letter-spacing: -0.02em;
}

.chk__loading-title span {
  color: var(--text-mute);
}

.chk__steps {
  display: grid;
  gap: 10px;
}

.chk__step {
  position: relative;
  padding-left: 28px;
  color: rgb(17 17 17 / 0.32);
  transition: color 300ms ease;
}

.chk__step::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.32em;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.chk__step.is-on {
  color: var(--ink);
}

.chk__step.is-on::before {
  border-color: #3d6bff;
  border-top-color: transparent;
  animation: chk-spin 900ms linear infinite;
}

.chk__step.is-done {
  color: var(--ink);
}

.chk__step.is-done::before {
  border-color: #3d6bff;
  background: #3d6bff;
  box-shadow: inset 0 0 0 2.5px var(--white);
}

.chk__bar {
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.chk__bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ink);
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  transition: transform 900ms var(--ease-out);
}

@keyframes chk-spin {
  to {
    rotate: 360deg;
  }
}

/* ------------------------------------------------------------------ results */

.chk__results {
  display: grid;
  gap: clamp(28px, 4vh, 44px);
  outline: none;
}

.chk__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.chk__for {
  color: var(--text-mute);
  overflow-wrap: anywhere;
}

.chk__for span {
  color: var(--ink);
}

.chk__tally {
  font-size: clamp(1.25rem, 0.95rem + 1vw, 1.75rem);
  letter-spacing: -0.02em;
}

/* Google's four scores, as rings that fill to the score. */
.chk__scores {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.chk__score {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.chk__ring {
  position: relative;
  width: clamp(76px, 8vw, 104px);
  aspect-ratio: 1;
}

.chk__ring svg {
  width: 100%;
  height: 100%;
  rotate: -90deg;
}

.chk__ring circle {
  fill: none;
  stroke-width: 6;
}

.chk__ring .chk__ring-track {
  stroke: var(--bone-deep);
}

.chk__ring .chk__ring-fill {
  stroke: var(--c, #3d6bff);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1200ms var(--ease-out);
}

.chk__ring b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(1.375rem, 1rem + 1vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.chk__score-name {
  font-size: 0.9375rem;
  color: var(--text-mute);
}

.chk__note {
  max-width: 70ch;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--bone);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-mute);
}

.chk__speed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 48px);
}

.chk__block {
  display: grid;
  align-content: start;
  gap: 12px;
}

.chk__h {
  color: var(--text-mute);
  font-weight: 400;
}

.chk__metrics,
.chk__fixes {
  border-top: 1px solid var(--line);
}

.chk__metrics li,
.chk__fixes li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.chk__metrics li span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.chk__metrics li b,
.chk__fixes li b {
  font-weight: 500;
  white-space: nowrap;
}

.chk__fixes li b {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: var(--fs-micro);
  font-weight: 400;
  color: var(--text-mute);
}

.chk__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}

/* The checks, grouped. */
.chk__groups {
  display: grid;
  gap: clamp(24px, 3.5vh, 36px);
}

.chk__group {
  display: grid;
  gap: 12px;
}

.chk__list {
  border-top: 1px solid var(--line);
}

.chk__item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 4px 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.chk__mark {
  grid-row: span 3;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.chk__mark circle {
  fill: var(--c);
}

.chk__mark path {
  fill: none;
  stroke: var(--white);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chk__item-title {
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.chk__item-detail {
  color: var(--text-mute);
  overflow-wrap: anywhere;
}

.chk__item-fix {
  font-size: 0.9375rem;
}

.chk__item-fix::before {
  content: "Fix: ";
  font-weight: 500;
}

/* Rows play in one after another as the results land. */
.chk__item,
.chk__score,
.chk__metrics li,
.chk__fixes li {
  animation: doc-rise 700ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.chk__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
  padding: clamp(20px, 3vw, 32px);
  border-radius: 16px;
  background: var(--bone);
}

.chk__cta-text {
  max-width: 44ch;
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem);
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.chk__cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
}

.chk__again {
  border: 0;
  background: none;
  cursor: pointer;
}

/* ------------------------------------------------------------------ responsive */

@media (max-width: 719px) {
  .chk {
    padding-top: 32px;
  }

  .chk__field {
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    border-radius: 20px;
  }

  .chk__field input {
    padding: 10px 12px;
  }

  .chk__go {
    justify-content: center;
  }

  .chk__scores {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 24px;
  }

  .chk__speed {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .chk[data-enter],
  .chk__item,
  .chk__score,
  .chk__metrics li,
  .chk__fixes li {
    animation: none;
  }

  .chk__step.is-on::before {
    animation: none;
  }

  .chk__ring .chk__ring-fill,
  .chk__bar span {
    transition: none;
  }
}
