/* ============================================================
   Tool page shell — shared by all utility pages
   Consumes tokens defined in styles.css
   ============================================================ */

body.us-tool {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--canvas);
}
body.us-tool > main { flex: 1; }

/* Shell */
.us-tool-main {
  padding-block: var(--space-7);
}
@media (min-width: 768px) { .us-tool-main { padding-block: var(--space-8); } }

.us-tool-wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
@media (min-width: 480px) { .us-tool-wrap { padding-inline: var(--space-5); } }
@media (min-width: 768px) { .us-tool-wrap { padding-inline: var(--space-6); gap: var(--space-7); } }
@media (min-width: 1024px) { .us-tool-wrap { padding-inline: var(--space-7); } }

/* Wide variant — full-bleed app-shell layout (e.g. SQLite viewer) */
.us-tool-wrap--wide { max-width: none; }

/* Hero header */
.us-tool-hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 65ch;
}
.us-tool-hero__kicker {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--coral-deep);
}
.us-tool-hero__title {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.3px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
}
.us-tool-hero__title i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: var(--coral-soft);
  color: var(--coral-deep);
  font-size: 22px;
}
.us-tool-hero__title--mint i { background: var(--mint-soft); color: var(--mint-deep); }
.us-tool-hero__title--butter i { background: var(--butter-soft); color: var(--butter-deep); }
.us-tool-hero__lead {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-muted);
  margin: 0;
}

/* Surface card — the main work area */
.us-tool-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
@media (min-width: 768px) { .us-tool-surface { padding: var(--space-6); } }

/* Toolbar */
.us-tool-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  justify-content: space-between;
}
.us-tool-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Buttons — re-uses us-btn from styles.css; add icon-only + ghost compact */
.us-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color var(--t-base) ease-out, transform var(--t-fast) var(--ease);
}
.us-tool-btn:hover { background: var(--surface-sunken); }
.us-tool-btn:active { transform: translateY(1px); }
.us-tool-btn--primary { background: var(--coral); color: var(--ink); }
.us-tool-btn--primary:hover { background: var(--coral-deep); color: var(--surface); }
.us-tool-btn--ghost { border-color: transparent; background: transparent; }
.us-tool-btn--ghost:hover { background: var(--surface-alt); }
.us-tool-btn--icon {
  width: 44px;
  padding: 0;
}
.us-tool-btn[disabled],
.us-tool-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* File picker — label-as-button */
.us-tool-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  border: 2px solid var(--ink);
  background: var(--coral);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color var(--t-base) ease-out;
}
.us-tool-file:hover { background: var(--coral-deep); color: var(--surface); }
.us-tool-file input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Fields */
.us-tool-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.us-tool-field__label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.us-tool-field textarea,
.us-tool-field input[type="text"],
.us-tool-field input[type="search"] {
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  transition: border-color var(--t-base) ease-out, box-shadow var(--t-base) ease-out;
}
.us-tool-field textarea { min-height: 220px; }
.us-tool-field textarea:focus,
.us-tool-field input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--coral-soft);
}

/* Two-pane layout */
.us-tool-panels {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .us-tool-panels { grid-template-columns: 1fr 1fr; gap: var(--space-5); }
}

/* Flash states (validation feedback) */
.us-tool-field--ok textarea,
.us-tool-field--ok input {
  border-color: var(--mint-deep);
  box-shadow: 0 0 0 3px var(--mint-soft);
}
.us-tool-field--warn textarea,
.us-tool-field--warn input {
  border-color: var(--butter-deep);
  box-shadow: 0 0 0 3px var(--butter-soft);
}
.us-tool-field--err textarea,
.us-tool-field--err input {
  border-color: var(--coral-deep);
  box-shadow: 0 0 0 3px var(--coral-soft);
}
@media (prefers-reduced-motion: reduce) {
  .us-tool-field textarea,
  .us-tool-field input { transition: none; }
}

/* Status line */
.us-tool-status {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0;
}

/* Inline head — label + small button row */
.us-tool-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.us-tool-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--t-base) ease-out;
}
.us-tool-inline-btn:hover { background: var(--surface-sunken); }
.us-tool-inline-btn--ok { background: var(--mint-soft); border-color: var(--mint-deep); color: var(--mint-deep); }

/* Notes / SEO / FAQ blocks */
.us-tool-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}
.us-tool-note h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 var(--space-3);
  color: var(--ink);
}
.us-tool-note h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: var(--space-4) 0 var(--space-2);
  color: var(--ink);
}
.us-tool-note p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-muted);
  margin: 0 0 var(--space-3);
  max-width: 65ch;
}
.us-tool-note code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-sunken);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--ink);
}
.us-tool-note dl { margin: 0; }
.us-tool-note dt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  margin-top: var(--space-4);
}
.us-tool-note dd {
  margin: var(--space-2) 0 0;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 65ch;
}

/* Welcome / empty / error panels */
.us-tool-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-7) var(--space-5);
  text-align: center;
}
.us-tool-empty__icon {
  width: 72px; height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--coral-soft);
  color: var(--coral-deep);
  font-size: 32px;
}
.us-tool-empty__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.us-tool-empty__lead {
  font-size: 16px;
  color: var(--ink-muted);
  max-width: 52ch;
  margin: 0;
}

.us-tool-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--coral-soft);
  border: 1px solid var(--coral);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 14px;
}
.us-tool-error::before {
  content: "\f071"; /* fa-triangle-exclamation */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--coral-deep);
}
