@charset "utf-8";
/* ==========================================================================
   ToolsHub4u — Family sheet: TEXT & WRITING (23 pages)
   Hue: --cat-text (teal). tools.css owns the workbench chrome and result
   readout types; this sheet owns the writing surface itself — the textarea,
   the counters strip, chips, the diff ledger, the unicode grid, item lists
   and the speech panel. Tokens only; no hard-coded colour.
   ========================================================================== */

/* ---------- 1. Local handles ---------------------------------------------- */
.wb {
  --fam: var(--cat-text);
  --fam-soft: color-mix(in srgb, var(--fam) 14%, transparent);
  --fam-line: color-mix(in srgb, var(--fam) 42%, transparent);
  --lab-t: 0.6875rem;
  --lab-ls: 0.1em;
}

/* ---------- 2. The writing surface --------------------------------------- */
.wb-field textarea {
  display: block;
  width: 100%;
  min-height: 172px;
  padding: 15px 17px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--ink-800);
  color: var(--text-100);
  font-family: var(--font-text);
  font-size: 0.9375rem;
  line-height: 1.75;
  font-variant-numeric: normal;
  resize: vertical;
  overflow: auto;
  transition: border-color 160ms, background-color 160ms, box-shadow 160ms;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink-900) 55%, transparent);
}
.wb-field textarea:hover { border-color: var(--line-3); }
/* .wb-form textarea:focus from tools.css is an equal-specificity rule that
   loads first, so qualify with the form element to win the cascade. */
.wb-form .wb-field textarea:focus,
.wb-form .wb-field textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--fam);
  background: var(--ink-700);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink-900) 55%, transparent);
}
.wb-field textarea::placeholder { color: var(--text-300); }
/* a lone wide textarea is the page's hero control: give it height */
.wb-field--wide > textarea { min-height: 216px; }

/* ---------- 3. Counter strip under the surface --------------------------- */
.txt-live-count {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: var(--lab-t);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--text-100);
  background: var(--ink-600);
  white-space: nowrap;
}
.wb-form__foot { row-gap: 10px; }

/* ---------- 4. Chips: case, tone and option pickers ---------------------- */
.wb-chips--text { gap: 6px; }
.wb-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--line-2);
  border-radius: 100px;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 520;
  color: var(--text-200);
  cursor: pointer;
  transition: border-color 150ms, background-color 150ms, color 150ms;
}
.wb-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wb-chip:hover { border-color: var(--line-3); color: var(--text-100); background: color-mix(in srgb, var(--text-100) 5%, transparent); }
.wb-chip:has(input:checked) {
  border-color: var(--fam);
  background: var(--fam-soft);
  color: var(--text-100);
  font-weight: 600;
}
.wb-chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.wb-chip:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }

/* a hairline-ruled checkbox block */
.txt-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 2px 18px;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--ink-800);
}
.txt-check-grid .wb-check { padding: 7px 0; }
.txt-check-grid .wb-check input[type="checkbox"] { accent-color: var(--fam); }

/* ---------- 5. Output surface -------------------------------------------- */
.txt-output-wrap { display: grid; gap: 7px; }
.res-primary + .txt-output-wrap,
.res-status + .txt-output-wrap,
.txt-preview-wrap + .res-stats { margin-top: 16px; }
.txt-output-label {
  font-family: var(--font-mono);
  font-size: var(--lab-t);
  font-weight: 550;
  letter-spacing: var(--lab-ls);
  text-transform: uppercase;
  color: var(--text-300);
}
.txt-output {
  display: block;
  width: 100%;
  min-height: 156px;
  max-height: 360px;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--ink-800);
  color: var(--text-100);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transition: border-color 160ms, background-color 160ms;
}
.txt-output:hover { border-color: var(--line-3); }
.txt-output:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--fam);
}
.txt-preview-wrap { display: grid; gap: 7px; margin-top: 16px; }
.txt-preview {
  padding: 14px 16px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--ink-800);
  color: var(--text-200);
  font-size: 0.9375rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
  max-width: 72ch;
}

/* ---------- 6. Diff ledger ------------------------------------------------ */
.txt-diff {
  display: grid;
  margin-top: 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.txt-diff-head,
.txt-diff-row {
  display: grid;
  grid-template-columns: 22px 1.4ch 2.6ch 2.6ch minmax(0, 1fr);
  align-items: baseline;
  gap: 0 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line-1);
}
.txt-diff-head {
  padding-block: 8px;
  background: var(--ink-600);
  border-bottom-color: var(--line-2);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-300);
}
.txt-diff-row:last-child { border-bottom: 0; }
.txt-diff-row { color: var(--text-200); background: var(--ink-800); }
.txt-diff-row[data-type="added"] {
  background: color-mix(in srgb, var(--cat-games) 8%, var(--ink-800));
  box-shadow: inset 2px 0 0 0 color-mix(in srgb, var(--cat-games) 65%, transparent);
}
.txt-diff-row[data-type="removed"] {
  background: color-mix(in srgb, var(--cat-pdf) 8%, var(--ink-800));
  box-shadow: inset 2px 0 0 0 color-mix(in srgb, var(--cat-pdf) 65%, transparent);
}
.txt-diff-mark { font-weight: 700; color: var(--text-300); text-align: center; }
.txt-diff-row[data-type="added"] .txt-diff-mark { color: var(--text-100); }
.txt-diff-row[data-type="removed"] .txt-diff-mark { color: var(--text-100); }
.txt-diff-ln {
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-300);
  text-align: right;
}
.txt-diff-text {
  min-width: 0;
  font-family: var(--font-text);
  font-size: 0.8125rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* ---------- 7. Grammar review and inline marks --------------------------- */
.txt-review {
  padding: 16px 17px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--ink-800);
  color: var(--text-200);
  font-size: 0.9375rem;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 72ch;
}
.txt-mark,
.txt-now mark {
  padding: 0 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--fam) 20%, transparent);
  color: var(--text-100);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: help;
}
.txt-mark[data-tone="spelling"] { background: color-mix(in srgb, var(--cat-pdf) 18%, transparent); }
.txt-mark[data-tone="style"] { background: color-mix(in srgb, var(--cat-seo) 16%, transparent); }
.txt-mark[data-tone="ok"] { background: color-mix(in srgb, var(--cat-games) 14%, transparent); text-decoration: none; }

/* ---------- 8. Unicode grid: hairline cells ------------------------------ */
.txt-grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 1px; }
.txt-grid-item {
  display: grid;
  gap: 1px;
  padding: 9px 11px;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-xs);
  background: var(--ink-800);
  min-width: 0;
}
.txt-grid-item[data-tone="hidden"] {
  border-color: color-mix(in srgb, var(--cat-pdf) 40%, transparent);
  background: color-mix(in srgb, var(--cat-pdf) 7%, var(--ink-800));
}
.txt-grid-char {
  font-size: 1.375rem;
  line-height: 1.25;
  color: var(--text-100);
  overflow-wrap: anywhere;
}
.txt-grid-code {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  color: var(--text-300);
  overflow-wrap: anywhere;
}
.txt-grid-note { font-size: 0.6875rem; line-height: 1.4; color: var(--text-300); overflow-wrap: anywhere; }
.txt-grid-more {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: var(--lab-t);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-300);
}

/* ---------- 9. Item lists: hairline-separated, not cards ----------------- */
.txt-items { display: grid; gap: 0; }
.txt-item { padding: 11px 2px; border-bottom: 1px solid var(--line-1); }
.txt-item:first-child { padding-top: 2px; }
.txt-item:last-child { border-bottom: 0; }
.txt-item__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.txt-item__head strong { color: var(--text-100); font-size: 0.875rem; font-weight: 620; }
.txt-item__meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--text-300);
}
.txt-item__body { margin: 4px 0 0; color: var(--text-300); font-size: 0.8125rem; line-height: 1.55; max-width: 68ch; }
.txt-item__text {
  display: inline-block;
  margin-top: 7px;
  padding: 2px 7px;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-xs);
  background: var(--ink-600);
  color: var(--text-100);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

/* ---------- 10. Speech / recording panel -------------------------------- */
.txt-panel {
  display: grid;
  gap: 14px;
  margin: -4px -1px 20px;
  padding: 15px 16px 16px;
  border: 1px solid var(--line-2);
  border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--ink-800);
}
.txt-panel__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.txt-panel__title {
  font-family: var(--font-mono);
  font-size: var(--lab-t);
  font-weight: 550;
  letter-spacing: var(--lab-ls);
  text-transform: uppercase;
  color: var(--text-300);
}
.txt-panel__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.txt-panel .btn { min-height: 36px; padding: 8px 14px; font-size: 0.8125rem; }
.txt-panel .btn[disabled] { opacity: 0.38; cursor: not-allowed; pointer-events: none; }
.txt-panel__status {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-300);
  font-variant-numeric: tabular-nums;
}
.txt-panel__status[data-tone="warn"] { color: var(--cat-pdf); }
.txt-panel__status[data-tone="ok"] { color: var(--phosphor-text); }

.txt-rec-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--cat-pdf);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--cat-pdf) 45%, transparent);
}
.txt-rec-dot[data-on="true"] { animation: txt-pulse 1.4s ease-out infinite; }
@keyframes txt-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cat-pdf) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 8px transparent; }
}

.txt-meter {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--ink-400);
  overflow: hidden;
}
.txt-meter__fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 2px;
  background: var(--fam);
  transition: width 160ms linear;
}

.txt-now {
  padding: 10px 12px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--ink-700);
  color: var(--text-300);
  font-size: 0.875rem;
  line-height: 1.6;
  max-height: 150px;
  overflow: auto;
  max-width: 72ch;
}
.txt-interim {
  min-height: 20px;
  font-size: 0.8125rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--text-300);
}
.txt-voice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.txt-toolbox-presets { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- 11. Ranges (speech rate / pitch) share the calc fader -------- */
.wb-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  align-items: center;
  gap: 14px;
}
.wb-range input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --pct: 50%;
}
.wb-range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--fam) 0 var(--pct), var(--ink-400) var(--pct) 100%);
}
.wb-range input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--ink-400); }
.wb-range input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--fam); }
.wb-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--ink-700);
  border: 2px solid var(--fam);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 140ms var(--ease-out);
}
.wb-range input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-700);
  border: 2px solid var(--fam);
}
.wb-range input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.12); }
.wb-range input[type="range"]:focus-visible { outline: none; }
.wb-range input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.wb-range input[type="range"]:focus-visible::-moz-range-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.wb-range .wb-input-wrap input { text-align: right; font-family: var(--font-mono); }

/* ---------- 12. Toast ---------------------------------------------------- */
.txt-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: 100px;
  background: var(--ink-600);
  color: var(--text-100);
  box-shadow: var(--shadow-2);
  font-size: 0.8125rem;
  text-align: center;
}
.txt-toast[data-tone="ok"] { border-color: color-mix(in srgb, var(--phosphor) 45%, transparent); }
.txt-toast[data-tone="warn"] { border-color: color-mix(in srgb, var(--cat-pdf) 45%, transparent); }

/* ---------- 13. Embedded third-party tool -------------------------------- */
.embed-card {
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  background: var(--ink-700);
  overflow: hidden;
}
.embed-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-1);
}
.embed-card__head h3 { font-size: 1.0625rem; color: var(--text-100); }
.embed-card__note { max-width: 46ch; color: var(--text-300); font-size: 0.8125rem; line-height: 1.5; }
.embed-frame { display: block; width: 100%; height: 760px; border: 0; background: var(--ink-600); color-scheme: light; }
.embed-card__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line-1);
  color: var(--text-300);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.embed-card__foot a { color: var(--text-200); text-decoration: underline; text-underline-offset: 2px; }
.embed-card__foot a:hover { color: var(--text-100); }

/* ---------- 14. Responsive ----------------------------------------------- */
@media (max-width: 640px) {
  .wb-field textarea,
  .wb-field--wide > textarea { min-height: 152px; padding: 13px 14px; }
  .txt-output { min-height: 132px; padding: 12px 13px; font-size: 0.8125rem; }
  .txt-live-count { order: 3; margin-left: 0; width: 100%; text-align: center; }
  .txt-diff-head, .txt-diff-row { grid-template-columns: 18px 2.2ch 2.2ch minmax(0, 1fr); padding: 6px 9px; gap: 0 6px; font-size: 0.75rem; }
  .txt-diff-head > span:nth-child(2) { display: none; }
  .txt-grid-list { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); }
  .txt-panel { padding: 12px 13px 14px; }
  .txt-panel__actions { margin-left: 0; width: 100%; }
  .txt-panel__actions .btn { flex: 1; }
  .wb-range { grid-template-columns: minmax(0, 1fr) 72px; gap: 10px; }
  .txt-toast { bottom: 16px; }
  .embed-card__head, .embed-card__foot { padding-inline: 14px; }
  .embed-frame { height: 700px; }
}

/* ---------- 15. Motion fallbacks ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .wb-field textarea, .txt-output, .txt-meter__fill, .txt-chip,
  .wb-range input[type="range"]::-webkit-slider-thumb { transition: none; }
  .wb-range input[type="range"]:hover::-webkit-slider-thumb { transform: none; }
  .txt-rec-dot[data-on="true"] { animation: none; }
}
/* ---------- 16. Slider fill position -------------------------------------
   Same delegate as the calculator sheet; see family-calc.css. */

/* ---------- 17. Checkbox focus ring (gap in the shared chrome) -----------
   Same fix as family-calc.css: .wb-check has no ring from tools.css. */
.wb-check input[type="checkbox"]:focus-visible,
.wb-check input[type="radio"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}