/* ============================================================
   DOMAIN CLEANER — /domains/domain-cleaner/
   Loaded on this page only. Owns the tool card: the textarea,
   the run button and its armed/launching states, the option
   toggles, the status line and the instructions dialog.
   ============================================================ */

.cleaner {
  position: relative;
  display: block;
}

.cleaner__field {
  position: relative;
}

.cleaner__input {
  display: block;
  width: 100%;
  min-height: 240px;
  padding: var(--sp-4);
  padding-right: calc(var(--sp-4) + 44px);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--ink-900);
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: var(--r-lg);
  resize: vertical;
  transition: border-color var(--dur-base) var(--ease-out);
}

.cleaner__input::placeholder {
  color: var(--slate-400);
}

.cleaner__input:hover {
  border-color: var(--slate-400);
}

.cleaner__input:focus-visible {
  outline: 2px solid var(--color-focus, var(--brand-600));
  outline-offset: 2px;
}

.cleaner__clear {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: var(--fs-lg);
  line-height: 1;
  color: var(--slate-500);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-full);
  cursor: pointer;
  transition:
    color var(--dur-base) var(--ease-out),
    background var(--dur-base) var(--ease-out);
}

.cleaner__clear:hover {
  color: var(--ink-900);
  background: var(--slate-200);
}

/* Readout row: the count on the left, the copy status on the right. */
.cleaner__readout {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  min-height: 20px;
  font-size: var(--fs-sm);
}

.cleaner__count {
  margin: 0;
  font-weight: 650;
  color: var(--ink-900);
}

.cleaner__status {
  margin: 0;
  color: var(--slate-500);
}

.cleaner__status--ok {
  color: var(--brand-700);
  font-weight: 650;
}

.cleaner__status--warn {
  color: var(--amber-700);
  font-weight: 650;
}

/* ------------------------------------------------------------
   THE RUN BUTTON
   A launch control: inert until there is text, ringed and
   pulsing once armed, and briefly lifted as it fires. The pulse
   animates an overlay's transform and opacity only — never the
   box itself — and stops under reduced motion.
   ------------------------------------------------------------ */
.cleaner__run {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: var(--sp-4);
}

.cleaner__run::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
  opacity: 0;
  pointer-events: none;
}

.cleaner__run:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Armed: text is waiting to be cleaned. */
.cleaner.is-armed .cleaner__run:not(:disabled) {
  box-shadow: 0 10px 26px -10px rgba(10, 129, 88, 0.65);
}

.cleaner.is-armed .cleaner__run:not(:disabled)::after {
  animation: cleanerRing 1.6s var(--ease-out) infinite;
}

@keyframes cleanerRing {
  0% { opacity: 0.75; transform: scale(1); }
  70% { opacity: 0; transform: scale(1.12); }
  100% { opacity: 0; transform: scale(1.12); }
}

/* Firing: one lift, once. */
.cleaner.is-launching .cleaner__run:not(:disabled) {
  animation: cleanerLaunch 700ms var(--ease-out);
}

@keyframes cleanerLaunch {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-4px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .cleaner.is-armed .cleaner__run::after,
  .cleaner.is-launching .cleaner__run {
    animation: none;
  }
}

/* ------------------------------------------------------------
   OPTIONS
   ------------------------------------------------------------ */
.cleaner__options {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--slate-200);
}

.cleaner__options-label {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 650;
  text-transform: uppercase;
  color: var(--slate-500);
}

/* Options: a wrapping row on the stage's wide card — four toggles and
   four checkboxes fit comfortably side by side at 880px, and a column
   made the card needlessly tall. */
.cleaner__toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-5);
}

.cleaner__toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}

.cleaner__seg {
  display: inline-flex;
  padding: 3px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-full);
}

.cleaner__seg-btn {
  min-height: 28px;
  padding: 2px var(--sp-3);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--slate-600);
  background: transparent;
  border: 0;
  border-radius: var(--r-full);
  cursor: pointer;
  transition:
    color var(--dur-base) var(--ease-out),
    background var(--dur-base) var(--ease-out);
}

.cleaner__seg-btn.is-active {
  color: var(--ink-900);
  background: var(--white);
  box-shadow: 0 1px 2px rgba(10, 18, 32, 0.12);
}

.cleaner__seg-btn:focus-visible {
  outline: 2px solid var(--color-focus, var(--brand-600));
  outline-offset: 2px;
}

.cleaner__check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 24px;
  font-size: var(--fs-sm);
  color: var(--slate-600);
  cursor: pointer;
}

.cleaner__check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-600);
  margin: 0;
}

.cleaner__hint {
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-xs);
  color: var(--slate-500);
}

/* ------------------------------------------------------------
   INSTRUCTIONS
   ------------------------------------------------------------ */
.cleaner__howto-open {
  display: inline-block;
  margin-top: var(--sp-4);
  padding: 0;
  min-height: 24px;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--brand-700);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cleaner__howto-open:focus-visible {
  outline: 2px solid var(--color-focus, var(--brand-600));
  outline-offset: 2px;
}

.cleaner__dialog {
  width: min(480px, calc(100vw - var(--sp-6)));
  padding: var(--sp-6);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -24px rgba(10, 18, 32, 0.45);
}

.cleaner__dialog::backdrop {
  background: rgba(10, 18, 32, 0.6);
  backdrop-filter: blur(2px);
}

.cleaner__dialog h2 {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-xl);
}

.cleaner__dialog ol {
  margin: 0 0 var(--sp-5);
  padding-left: 1.2em;
  color: var(--slate-600);
}

.cleaner__dialog li + li {
  margin-top: var(--sp-2);
}

.cleaner__dialog-foot {
  display: flex;
  justify-content: flex-end;
}
