/* ============================================================================
   TEKST-OPSCHONER
   Alles staat achter .to. Opmaak van de tekstvakken en vinkjes volgt de
   B1-check, zodat de tools als familie herkenbaar zijn.
   ============================================================================ */

.to {
  --to-panel:     var(--white-overlay);
  --to-paper-2:   var(--grey-overlay);
  --to-ink:       var(--text);
  --to-ink-soft:  color-mix(in oklch, var(--text) 80%, var(--background));
  --to-ink-faint: color-mix(in oklch, var(--text) 55%, var(--background));
  --to-line:      color-mix(in oklch, var(--text) 16%, var(--background));
  --to-line-soft: color-mix(in oklch, var(--text) 9%, var(--background));
  --to-ui:   'Rubik', sans-serif;
  --to-read: 'Crimson Text', serif;

  max-width: 1200px;
  margin: 0 auto 2rem;
  font-family: var(--to-ui);
  color: var(--to-ink);
}

[data-theme="dark"] .to {
  --to-line:      color-mix(in oklch, var(--text) 28%, var(--background));
  --to-line-soft: color-mix(in oklch, var(--text) 14%, var(--background));
}

.to *, .to *::before, .to *::after { box-sizing: border-box; }
.to p { margin: 0; }
.to h2 { font-size: 0.85rem; font-weight: 600; letter-spacing: 0.01em; margin: 0; }

/* ---------- intro ---------- */
.to-intro { padding: 2.2rem 0 1.2rem; }
.to-intro .to-kicker { max-width: 46rem; }
.to-kicker {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--main-color);
}
.to-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.2rem 0 0.6rem;
}
.to-title-row h1 { margin: 0; }
.to-help {
  flex: none;
  width: 0.95rem;
  height: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--to-ui);
  font-size: 0.52rem;
  font-weight: 600;
  line-height: 1;
  color: var(--to-ink);
  background: var(--to-panel);
  border: 1.5px solid var(--to-ink);
  border-radius: 5px;
  box-shadow: var(--shadow-subtle);
  cursor: pointer;
  padding: 0;
  transition: background-color .15s, color .15s;
}
.to-help:hover { background: var(--to-ink); color: var(--background); }

.to button:focus-visible, .to textarea:focus-visible, .to-output:focus-visible {
  outline: 2px solid var(--main-color);
  outline-offset: 2px;
}

/* ---------- panelen ---------- */
.to-panel, .to-pane {
  background: var(--to-panel);
  border-radius: 12px;
  box-shadow: var(--shadow-subtle);
  padding: 0.8rem 0.9rem 0.9rem;
}

/* ---------- vinkjes (zoals in de B1-check en vaten.css) ---------- */
.to-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.4rem;
  margin-bottom: 0.9rem;
}
.to-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.6rem;
  color: var(--to-ink);
  cursor: pointer;
  user-select: none;
}
.to-toggle input {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  position: relative;
  width: 14px;
  height: 14px;
  margin: 0 3px 0 0;
  flex: none;
  cursor: pointer;
  border: 1.5px solid var(--text);
  border-radius: 1px;
  background-color: var(--white-overlay);
}
.to-toggle input:checked { border: 0; }
.to-toggle input:checked::after {
  content: "";
  position: absolute;
  left: 0;
  top: -1.27px;
  width: 16.9px;
  height: 15.25px;
  background-color: var(--main-color);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='33.3 28 85.5 77.1'%3E%3Cpath d='M85.9 37.9H36.8V101.6H100.6V54' fill='none' stroke='%23000' stroke-width='7'/%3E%3Cpath d='M50.35 51.34a7.13 7.13 0 0 0-3.62 7.18c.83 3.18 7.59 4.03 15.36 17.88l4.2 8.3a7.14 7.14 0 0 0 12.25 .36l4.42-9.58c13.44-26.59 29.5-34.45 30.37-36.12 2.48-4.76-4.1-10.97-11.42-8.77-2.01.61-14.17 8.66-28.3 31.6l-1.57 2.55-2.16-3.07C61.7 51.31 56.65 47.34 50.35 51.34Z'/%3E%3C/svg%3E") left top / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='33.3 28 85.5 77.1'%3E%3Cpath d='M85.9 37.9H36.8V101.6H100.6V54' fill='none' stroke='%23000' stroke-width='7'/%3E%3Cpath d='M50.35 51.34a7.13 7.13 0 0 0-3.62 7.18c.83 3.18 7.59 4.03 15.36 17.88l4.2 8.3a7.14 7.14 0 0 0 12.25 .36l4.42-9.58c13.44-26.59 29.5-34.45 30.37-36.12 2.48-4.76-4.1-10.97-11.42-8.77-2.01.61-14.17 8.66-28.3 31.6l-1.57 2.55-2.16-3.07C61.7 51.31 56.65 47.34 50.35 51.34Z'/%3E%3C/svg%3E") left top / 100% 100% no-repeat;
}
.to-toggle input:not(:checked) + span { opacity: .5; text-decoration: line-through; }
.to-toggle:has(input:focus-visible) span { outline: 2px solid var(--main-color); outline-offset: 2px; border-radius: 2px; }

/* ---------- tekstvakken ---------- */
.to-work {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.to-pane { display: flex; flex-direction: column; min-width: 0; }
.to-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 1.6rem;
  margin-bottom: 0.6rem;
}

.to-box {
  font-family: var(--to-read);
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--to-ink);
  min-height: 26rem;
  height: 60vh;
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  overflow: auto;
  background: var(--background);
}
.to-input {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--to-line);
}
.to-input::placeholder { color: var(--to-ink-faint); }
.to-output {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--to-line-soft);
  resize: vertical;
  user-select: text;
}
.to-output.is-empty::before {
  content: 'De opgeschoonde tekst verschijnt hier.';
  color: var(--to-ink-faint);
  font-style: italic;
}

.to-btn {
  font-family: var(--to-ui);
  font-size: 0.55rem;
  border: 1px solid var(--to-line);
  background: var(--to-panel);
  color: var(--to-ink-soft);
  padding: 0.25rem 0.65rem;
  border-radius: 7px;
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
}
.to-btn:hover:not(:disabled) { border-color: var(--to-ink-faint); color: var(--to-ink); }
.to-btn:disabled { opacity: 0.4; cursor: default; }
.to-btn.is-done { color: var(--main-color); border-color: var(--main-color); }

/* ---------- uitleg (dialoog) ---------- */
.to-dialog {
  width: min(44rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 4rem);
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--to-panel);
  color: var(--to-ink);
  box-shadow: var(--shadow-hard);
  overflow: auto;
}
.to-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.to-dialog-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.2rem 2.6rem 0.8rem;
  background: var(--to-panel);
  border-bottom: 1px solid var(--to-line-soft);
}
.to-dialog-close {
  width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--to-ink-soft);
  background: var(--to-panel);
  border: 1px solid var(--to-line);
  border-radius: 7px;
  cursor: pointer;
  padding: 0;
}
.to-dialog-close:hover { color: var(--to-ink); border-color: var(--to-ink-faint); }
.to-how { padding: 0.4rem 2.6rem 2.4rem; }
.to-how p, .to-how li {
  font-family: var(--to-read);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--to-ink-soft);
}
.to-how p { margin-top: 0.6rem !important; }
.to-how ul { padding-left: 1.1rem; margin: 0.6rem 0 0; }
.to-how li { list-style: circle; margin-bottom: 0.35rem; }
.to-how .to-how-lead { color: var(--to-ink); }
.to-how .to-how-privacy {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin-top: 0.8rem !important;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: var(--to-paper-2);
  font-family: var(--to-ui);
  font-size: 0.6rem;
  line-height: 1.45;
  color: var(--to-ink-soft);
}
.to-how-privacy svg { flex: none; margin-top: 0.12rem; }
.to-how h3 {
  font-family: var(--to-ui);
  font-size: 0.68rem;
  font-weight: 600;
  margin: 1.1rem 0 0;
}
.to-how b { font-weight: 600; color: var(--to-ink); }

/* ---------- responsief ---------- */
@media (max-width: 980px) {
  .to h2 { font-size: 1rem; }
  .to-kicker { font-size: 0.7rem; }
  .to-toggle, .to-btn { font-size: 0.8rem; }
  .to-box { font-size: 1.05rem; }
  .to-how p, .to-how li { font-size: 1rem; }
  .to-how .to-how-privacy { font-size: 0.8rem; }
  .to-how h3 { font-size: 0.9rem; }
  .to-help { width: 1.3rem; height: 1.3rem; font-size: 0.75rem; }
  .to-dialog-close { width: 1.9rem; height: 1.9rem; font-size: 1.2rem; }
}

@media (max-width: 760px) {
  .to-work { grid-template-columns: 1fr; }
  .to-box { height: auto; min-height: 14rem; }
  .to-output { max-height: 70vh; }
  .to-dialog-head { padding: 1.4rem 1.4rem 0.7rem; }
  .to-how { padding: 0.3rem 1.4rem 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .to * { transition: none !important; }
}
