/* Shared chrome for tool pages. Loaded after style.css, which supplies the
   design tokens (--accent, --ink, --card, --rule …) and the pill nav. */

.tool {
  width: var(--shell);
  margin-inline: auto;
  padding-block: clamp(3rem, 7vw, 5rem) clamp(4rem, 9vw, 7rem);
}

.tool-head {
  max-width: 42rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.tool-head h1 {
  font-size: clamp(2.25rem, 1.4rem + 3.4vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.tool-head .lede {
  margin-top: 1rem;
  max-width: 46ch;
  font-style: italic;
  color: var(--ink-muted);
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: var(--fs-small);
  color: var(--ink-muted);
}

.crumb:hover {
  color: var(--ink);
}

/* ---------- layout ---------- */

.tool-grid {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;

  @media (min-width: 60em) {
    grid-template-columns: minmax(0, 1fr) 22rem;
  }
}

.panel {
  padding: clamp(1.5rem, 3vw, 2rem);
  border-radius: 0.75rem;
  background-color: var(--card);
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.06), 0 10px 24px hsl(0 0% 0% / 0.06);
}

.panel + .panel {
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.panel > h2 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.panel > h2 + * {
  margin-top: 1.5rem;
}

.summary-panel {
  @media (min-width: 60em) {
    position: sticky;
    top: 6rem;
  }
}

/* ---------- form controls ---------- */

.field + .field,
.field + .field-row,
.field-row + .field,
.field-row + .field-row {
  margin-top: 1.25rem;
}

/* inside a two-up row the grid gap does the spacing, so the stacking
   margin above must not also apply to the second column */
.field-row > .field + .field {
  margin-top: 0;
}

.field label,
.field-row label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: var(--fs-small);
  font-weight: 500;
}

.field .hint {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  background-color: var(--bg-alt);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field-row {
  display: grid;
  gap: 1rem;

  @media (min-width: 34em) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  background-color: var(--bg-alt);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  border-color: var(--ink-muted);
}

.btn-primary {
  border-color: transparent;
  background-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background-color: var(--accent-deep);
}

.btn-ghost {
  border-color: transparent;
  background: none;
  color: var(--ink-muted);
}

.btn-ghost:hover {
  color: var(--ink);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ---------- misc ---------- */

.empty {
  padding: 2rem 1rem;
  border: 1px dashed var(--rule);
  border-radius: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.tool-foot {
  width: var(--shell);
  margin-inline: auto;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-small);
  color: var(--ink-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
