/* ── JSON Formatter — tool page styles ─────────────────────────────
   Builds on css/shared.css tokens. Same component family as the
   Network Tools pages (hero / card / chips / steps / faq). */

main { max-width: 860px; margin: 0 auto; padding: 20px; }

/* ── Tool hero (icon + title + subtitle) ───────────────────────── */
.tool-hero { max-width: 860px; margin: 0 auto; padding: 36px 20px 4px; }
.tool-hero .hero-head { display: flex; align-items: center; gap: 16px; }
.tool-hero .hero-icon {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 14px;
  background: #0f0e0d; display: flex; align-items: center; justify-content: center;
}
.tool-hero .hero-icon svg { width: 30px; height: 30px; stroke: var(--accent); }
.tool-hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.3rem); font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.tool-hero .subtitle { color: var(--muted); font-size: 1.02rem; margin-top: 12px; max-width: 680px; }

/* ── Tool card ─────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 24px; margin-top: 24px; }

/* ── Try chips (sample JSON) ───────────────────────────────────── */
.try-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.try-row .try-label { font-size: .85rem; color: var(--muted); font-weight: 600; margin-right: 2px; }
.try-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: .85rem; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 7px 13px; min-height: 36px; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.try-chip:hover { border-color: var(--accent); background: var(--accent-bg); transform: translateY(-1px); }

/* ── Editor ────────────────────────────────────────────────────── */
.field-label { display: block; font-size: .82rem; font-weight: 700; color: var(--text); margin-bottom: 7px; }
.editor {
  width: 100%; min-height: 230px; resize: vertical;
  font-family: var(--mono); font-size: .92rem; line-height: 1.6;
  padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); outline: none;
  tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto;
  transition: border-color .15s, box-shadow .15s;
}
.editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.editor::placeholder { color: var(--muted); }

/* ── Toolbar ───────────────────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.toolbar .spacer { flex: 1 1 auto; }
.indent-field { display: inline-flex; align-items: center; gap: 8px; }
.indent-field > span { font-size: .8rem; font-weight: 700; color: var(--muted); }
.net-select {
  font-family: var(--mono); font-size: .9rem;
  padding: 11px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); outline: none; cursor: pointer;
  transition: border-color .15s;
}
.net-select:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 11px 20px;
  font-family: inherit; font-size: .95rem; font-weight: 700;
  border: none; border-radius: var(--radius); cursor: pointer;
  background: var(--accent); color: #fff;
  transition: background .15s, transform .1s, opacity .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-h); }
.btn:active { transform: scale(.98); }
.btn svg { width: 16px; height: 16px; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); border-color: var(--muted); }

/* ── Status / error line ───────────────────────────────────────── */
.status-line { min-height: 22px; margin-top: 14px; font-size: .9rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.status-line.ok { color: var(--accent-fg); }
.status-line.error { color: #b42318; }
.status-line .stat-icon { font-family: var(--mono); }
.error-detail {
  margin-top: 10px; font-family: var(--mono); font-size: .84rem; line-height: 1.6;
  background: #fef3f2; border: 1px solid #fda29b; color: #912018;
  border-radius: var(--radius); padding: 12px 14px; white-space: pre-wrap; word-break: break-word;
}
.error-detail[hidden] { display: none; }

/* ── Trust row (free / private / offline) ──────────────────────── */
.trust-row { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.trust-item { display: inline-flex; align-items: center; gap: 7px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.trust-item svg { width: 16px; height: 16px; stroke: var(--accent); flex-shrink: 0; }

/* ── Content sections (how-it-works / faq) ─────────────────────── */
.section { max-width: 860px; margin: 16px auto; padding: 24px 20px; }
.section > h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.section > .section-sub { color: var(--muted); margin-bottom: 20px; }
.steps { display: grid; gap: 14px; }
.step { display: flex; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.step-num { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-fg); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.step-body h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.step-body p { font-size: .92rem; color: var(--muted); line-height: 1.6; }
.step-body a { color: var(--accent); }

.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.faq summary { cursor: pointer; padding: 16px 18px; font-weight: 700; font-size: .98rem; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--accent); font-weight: 700; }
.faq details[open] summary::after { content: '\2013'; }
.faq .faq-body { padding: 0 18px 16px; font-size: .92rem; color: var(--muted); line-height: 1.7; }
.faq .faq-body a { color: var(--accent); }
.faq .faq-body code { font-family: var(--mono); font-size: .85em; background: var(--surface2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }

/* ── Read-more content links (under tool) ──────────────────────── */
.learn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.learn-row a { font-size: .88rem; font-weight: 600; color: var(--accent); background: var(--accent-bg); border-radius: 999px; padding: 7px 15px; text-decoration: none; transition: background .15s; }
.learn-row a:hover { background: #d6e4fd; text-decoration: none; }

/* ── Toast ─────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: #fff; padding: 11px 20px; border-radius: var(--radius); font-size: .88rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 620px) {
  .tool-hero .hero-icon { width: 48px; height: 48px; }
  .toolbar .spacer { flex-basis: 100%; height: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

/* ── View toggle ─────────────────────────────────────────────── */
.view-toggle { display: inline-flex; gap: 4px; margin: 0 0 .6rem; padding: 4px; background: var(--accent-bg, #e8effe); border: 1px solid var(--border, #e4e3f2); border-radius: 999px; }
.vt-btn { appearance: none; border: 0; background: transparent; padding: .42rem 1.15rem; min-height: 36px; border-radius: 999px; font: inherit; font-size: .85rem; font-weight: 600; letter-spacing: .01em; cursor: pointer; color: var(--muted, #5c5b76); transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.vt-btn:hover:not(.is-active) { color: var(--accent, #2563eb); background: rgba(37, 99, 235, .08); }
.vt-btn.is-active { background: var(--accent, #2563eb); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .28); }
.vt-btn:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 2px; }

/* ── Tree ────────────────────────────────────────────────────── */
.tree-toolbar { display: flex; gap: .5rem; margin-bottom: .5rem; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; min-height: 36px; }
.tree { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; line-height: 1.6; overflow: auto; max-height: 60vh; padding: .5rem .25rem; border: 1px solid var(--border, #e4e3f2); border-radius: 10px; background: var(--surface, #fff); }
.jt-root, .jt-children { list-style: none; margin: 0; padding: 0; }
.jt-children { padding-left: 1.25rem; }
.jt-node.jt-collapsed > .jt-children { display: none; }
.jt-row { display: flex; align-items: center; gap: .15rem; border-radius: 6px; padding: .05rem .25rem; }
.jt-row:hover { background: var(--surface2, #efeefa); }
.jt-twist { appearance: none; border: 0; background: transparent; cursor: pointer; width: 1.1rem; height: 1.1rem; padding: 0; color: var(--muted, #5c5b76); flex: 0 0 auto; }
.jt-twist::before { content: "\25B8"; display: inline-block; transition: transform .12s; }
.jt-container:not(.jt-collapsed) > .jt-row > .jt-twist::before { transform: rotate(90deg); }
.jt-leaf-spacer { cursor: default; }
.jt-leaf-spacer::before { content: ""; }
.jt-key { color: var(--text, #16152e); font-weight: 600; }
.jt-punct { color: var(--muted, #5c5b76); }
.jt-count { color: var(--muted, #5c5b76); font-size: .8rem; }
.jt-string { color: var(--accent3, #0fb9a6); }
.jt-number { color: var(--accent, #6d4dff); }
.jt-bool { color: var(--accent2, #f43f7d); }
.jt-null { color: var(--muted, #5c5b76); font-style: italic; }
.jt-actions { display: inline-flex; gap: .25rem; margin-left: .5rem; opacity: 0; transition: opacity .1s; }
.jt-row:hover .jt-actions, .jt-row:focus-within .jt-actions { opacity: 1; }
.jt-act { appearance: none; border: 1px solid var(--border, #e4e3f2); background: var(--surface, #fff); border-radius: 5px; font-size: .72rem; padding: .05rem .4rem; cursor: pointer; color: var(--muted, #5c5b76); min-height: 24px; }
.jt-act:hover { color: var(--accent, #6d4dff); border-color: var(--accent, #6d4dff); }
@media (prefers-reduced-motion: reduce) { .jt-twist::before, .jt-actions { transition: none; } }
