/* ============================================================================
   Word Unscrambler — tool layer over base.css
   base.css supplies reset, type, forms, buttons, chips, badges, panels, tables,
   header, footer, focus rings. This file adds the accent and only what is
   unique to this tool.

   Accent — violet, measured against base.css surfaces (WCAG relative
   luminance):
     dark  #b761ef  5.4:1 on --bg   5.0:1 on --surface   5.6:1 on --bg-sunk
     light #5d0896  10.4:1 on --bg   10.8:1 on --surface   9.5:1 on --bg-sunk
   Both clear the 4.5:1 text floor on all three surfaces in both themes.
   ========================================================================= */
:root { --accent: #b761ef; --accent-dim: rgba(183, 97, 239, 0.14); }
@media (prefers-color-scheme: light) {
  :root { --accent: #5d0896; --accent-dim: rgba(93, 8, 150, 0.10); }
}

.brand svg .mark-bg { fill: var(--accent); }
.brand svg .mark-fg { fill: var(--on-accent); }

/* ============================================================================
   The tool
   ========================================================================= */

.tool {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 2.5rem;
}

.tool > h2 {
  margin: 0 0 1.1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.tool .field { margin-bottom: 0; }
.tool .field label { margin-bottom: 0.1rem; }

#letters-input {
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.err {
  display: block;
  min-height: 1.3em;
  margin-top: 0.4rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-dim);
}
.err.is-warn { color: var(--warn); }

/* ------------------------------------------------------------- filters -- */

.filters {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
}
.filters summary {
  padding-right: 1.75rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}
.filters[open] summary { margin-bottom: 0.2rem; }
.filters .fields {
  display: grid;
  gap: 0.9rem 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
  margin-top: 0.9rem;
}
.filters .field-label {
  font-size: 0.6875rem;
}

/* --------------------------------------------------------------- toolbar -- */

.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }

/* ------------------------------------------------------------- summary --- */

.summary-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.summary-row .readout { color: var(--accent); }
.summary-label {
  font-size: 0.9375rem;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------- groups -- */

.groups { margin-top: 1.25rem; }

.group { margin-bottom: 1.1rem; }
.group:last-child { margin-bottom: 0; }

.group-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-faint);
}
.group-head .count {
  font-weight: 400;
  color: var(--text-dim);
}

.word-chip {
  font-family: var(--mono);
  text-transform: lowercase;
}
.word-chip:hover { color: var(--accent); border-color: var(--accent); }
.word-chip.is-copied {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

.group-more {
  display: inline-block;
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.empty-state {
  color: var(--text-dim);
  font-size: 0.9375rem;
  padding: 0.5rem 0;
}

/* ============================================================================
   Article furniture (shared shapes used across NWT tools)
   ========================================================================= */

.section { max-width: 74ch; }
.section table { max-width: none; }

.callout {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.1rem;
  margin: 0 0 1.2em;
  font-size: 0.9375rem;
  color: var(--text-dim);
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--text); }

/* .formula is a <div> with white-space: pre, so base's `pre` rule can't reach it */
.formula {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0 0 1.2em;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.7;
  white-space: pre;
}

.tag-pass { color: var(--ok);  font-weight: 600; }
.tag-fail { color: var(--err); font-weight: 600; }
td .mono, th .mono { white-space: nowrap; }

.example {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.15rem;
  margin: 0 0 1rem;
}
.example h3 { margin-top: 0; }
.example p:last-child { margin-bottom: 0; }

.pagelinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.pagelinks a {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.15rem;
}
.pagelinks a:hover { border-color: var(--accent); }
.pagelinks strong { display: block; color: var(--accent); margin-bottom: 0.15rem; }
.pagelinks span   { display: block; color: var(--text-dim); font-size: 0.875rem; }

.noscript {
  background: var(--err-bg);
  border: 1px solid var(--err);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  color: var(--err);
  font-size: 0.9375rem;
}

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