/* Brazilian Dev — shared chrome for the in-hub dev tools (JSON / cron / regex).
   Loads AFTER tokens.css + styles.css; each tool adds a tiny per-tool CSS on top.
   All controls themed from tokens; no new colors invented. */

/* ---------- Tool header ---------- */
.tool-head { padding-top: clamp(1.75rem, 5vw, 3rem); }
.tool-head h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 900; line-height: 1.12; letter-spacing: -0.02em;
  margin-bottom: 0.7rem;
}
.tool-head .lead { margin-bottom: 0; }
.back-home {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--ink-2); font-weight: 600; font-size: 0.95rem;
  margin-bottom: var(--s-5);
}
.back-home:hover { color: var(--ink-0); text-decoration: none; }

/* ---------- JS-off / info notice ---------- */
.notice {
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  background: color-mix(in srgb, var(--amber) 8%, var(--bg-1));
  border-radius: var(--radius);
  padding: 1rem 1.2rem; margin: var(--s-5) 0;
  color: var(--ink-1);
}
.notice strong { color: var(--ink-0); }

/* ---------- Panels & layout ---------- */
.panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: var(--s-5);
}
.tool-cols { display: grid; grid-template-columns: 1fr; gap: var(--s-5); align-items: start; }
.tool-cols > * { min-width: 0; } /* let grid tracks shrink instead of overflowing to content width */
@media (min-width: 880px) { .tool-cols { grid-template-columns: 1fr 1fr; } }

.field-label {
  display: block; font-weight: 700; font-size: 0.9rem;
  color: var(--ink-1); margin-bottom: 0.4rem;
}
.hint { color: var(--ink-2); font-size: 0.88rem; }

/* ---------- Form controls ---------- */
textarea, input[type="text"], select {
  width: 100%;
  background: var(--bg-2);
  color: var(--ink-0);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--ease), box-shadow var(--ease);
}
textarea {
  font-family: var(--font-mono);
  font-size: 0.92rem; line-height: 1.6; resize: vertical; min-height: 220px;
}
/* Subtle border tint on any focus; the visible ring matches the rest of the site
   and only shows for keyboard focus (:focus-visible), never on mouse focus. */
textarea:focus, input[type="text"]:focus, select:focus {
  border-color: var(--accent);
}
textarea:focus-visible, input[type="text"]:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 0.7rem;
  border-color: var(--accent);
}
textarea::placeholder, input::placeholder { color: var(--ink-2); }

.mono { font-family: var(--font-mono); }

/* ---------- Toolbar & buttons ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: var(--s-4) 0; }
.btn-sm {
  min-height: 40px; padding: 0.45rem 0.9rem;
  border-radius: 0.6rem; font-size: 0.95rem; font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--bg-2); color: var(--ink-0); cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.4rem;
  transition: border-color var(--ease), background var(--ease), color var(--ease);
}
.btn-sm:hover { border-color: var(--accent); text-decoration: none; }
.btn-sm.is-primary { background: var(--accent-strong); color: var(--accent-ink); border-color: transparent; }
.btn-sm.is-primary:hover { background: color-mix(in srgb, var(--accent-strong) 85%, #000); }
.toolbar .spacer { margin-left: auto; }

.inline-field { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink-1); font-size: 0.9rem; }
.inline-field select { width: auto; padding: 0.4rem 0.6rem; }

/* ---------- Status line ---------- */
.status { margin-top: var(--s-4); font-size: 0.95rem; font-weight: 600; min-height: 1.4em; }
.status.is-ok { color: var(--teal); }
.status.is-err { color: #f87171; }
:root[data-theme="light"] .status.is-ok { color: #0f766e; }
:root[data-theme="light"] .status.is-err { color: #b91c1c; }

/* ---------- Output code block ---------- */
.code-out {
  margin: 0; padding: var(--s-4);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.9rem; line-height: 1.6; color: var(--ink-0);
  overflow: auto; max-height: 540px; white-space: pre;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Segmented control ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 0.6rem; overflow: hidden; }
.seg button {
  padding: 0.4rem 0.9rem; border: 0; background: transparent;
  color: var(--ink-1); font-weight: 600; font-size: 0.92rem; cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--accent-strong); color: var(--accent-ink); }

/* ---------- Cheatsheet ---------- */
.cheatsheet { margin-top: var(--s-6); }
.cheatsheet h2 { font-size: 1.2rem; margin-bottom: var(--s-3); }
.cheat-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.cheat-table th, .cheat-table td {
  text-align: left; padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.cheat-table th { color: var(--ink-1); font-weight: 700; }
.cheat-table td:first-child code, .cheat-table th:first-child { white-space: nowrap; }
code, kbd {
  font-family: var(--font-mono);
  background: color-mix(in srgb, var(--bg-3) 70%, transparent);
  border: 1px solid var(--border);
  border-radius: 0.35rem; padding: 0.05rem 0.35rem; font-size: 0.88em;
}

.tool-section { padding-top: 0; }
.tool-section + .tool-section { margin-top: var(--s-8); }
