/* =========================================================
   Tech Style Ltd — tool.css

   The online JSON workbench. Loaded only by json-minifier.html,
   because nothing else on the site needs 400 lines of editor
   chrome and the other twenty pages should not pay for it.

   It inherits the site's tokens from style.css — colours, type,
   radii, edges — and adds only the pieces a two-pane editor needs.
   ========================================================= */

/* ---------- Layout ---------- */
.tool {
  padding: 34px 0 62px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.tool-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;                 /* lets the editor shrink instead of pushing the grid wide */
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .06);
}

.tool-pane--drop {
  border-color: var(--pc);
  box-shadow: 0 0 0 1px var(--pc), 0 14px 38px rgba(0, 0, 0, .34);
}

.tool-pane-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--edge);
  background: rgba(0, 0, 0, .26);
}

.tool-pane-head h2,
.tool-pane-head h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-2);
}

.tool-pane-head .spacer {
  margin-left: auto;
}

/* ---------- The editors ---------- */
.tool-editor-wrap {
  position: relative;
  display: flex;
  min-height: 0;
}

.tool-editor {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 18px 18px 18px 16px;
  background: transparent;
  color: #dde5f5;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.7;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.tool-editor::placeholder {
  color: var(--text-3);
}

.tool-editor:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.tool-editor[readonly] {
  color: #c9d4ea;
}

/* ---------- Buttons ---------- */
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--edge);
  background: rgba(0, 0, 0, .18);
}

.tool-btn {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 50px;
  border: 1px solid var(--edge-2);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  transition: background .2s, border-color .2s, transform .15s var(--ease), color .2s;
}

.tool-btn:hover {
  background: var(--surface-2);
  border-color: var(--pcb);
  transform: translateY(-1px);
}

.tool-btn:active {
  transform: translateY(0);
}

.tool-btn--go {
  background: linear-gradient(120deg, var(--pc), var(--pc2));
  border-color: transparent;
  color: #07120a;
}

.tool-btn--go:hover {
  background: linear-gradient(120deg, var(--pc), var(--pc));
  color: #07120a;
}

.tool-btn--ghost {
  background: transparent;
  border-color: var(--edge);
  color: var(--text-2);
}

.tool-btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.tool-btn .k {
  font-size: .62rem;
  opacity: .6;
  letter-spacing: .1em;
}

/* ---------- Small inline controls ---------- */
.tool-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.tool-field select,
.tool-field input[type="text"] {
  appearance: none;
  background: rgba(0, 0, 0, .4);
  border: 1px solid var(--edge);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--mono);
  font-size: .72rem;
  padding: 6px 10px;
  text-transform: none;
  letter-spacing: 0;
}

.tool-field input[type="checkbox"] {
  accent-color: var(--pc);
  width: 15px;
  height: 15px;
}

.tool-field label {
  cursor: pointer;
}

/* ---------- Messages ---------- */
.tool-msg {
  display: none;
  padding: 13px 16px;
  border-top: 1px solid var(--edge);
  font-family: var(--mono);
  font-size: .76rem;
  line-height: 1.65;
}

.tool-msg.is-shown {
  display: block;
}

.tool-msg--ok {
  color: #9fe8c4;
  background: rgba(22, 217, 137, .09);
  border-top-color: rgba(22, 217, 137, .3);
}

.tool-msg--bad {
  color: #ffb3c1;
  background: rgba(255, 92, 122, .1);
  border-top-color: rgba(255, 92, 122, .34);
}

.tool-msg--info {
  color: var(--text-2);
  background: rgba(91, 134, 255, .08);
  border-top-color: rgba(91, 134, 255, .3);
}

.tool-msg b {
  color: inherit;
}

.tool-msg .where {
  display: block;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 7px;
  background: rgba(0, 0, 0, .42);
  color: #dde5f5;
  white-space: pre;
  overflow-x: auto;
}

.tool-msg .caret {
  color: var(--signal);
  font-weight: 700;
}

/* ---------- Measurements ---------- */
.tool-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--edge);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.tool-meter div {
  padding: 18px 20px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015));
}

.tool-meter dt {
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.tool-meter dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--text);
}

.tool-meter dd small {
  display: block;
  margin-top: 5px;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--text-3);
}

.tool-meter .win {
  color: #b6f24a;
}

.tool-meter .lose {
  color: #ffb3c1;
}

/* The saving bar: minified width against compressed width, to scale. */
.tool-bars {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.tool-bar {
  display: grid;
  grid-template-columns: 130px 1fr 96px;
  gap: 14px;
  align-items: center;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  color: var(--text-3);
}

.tool-bar .track {
  height: 12px;
  border-radius: 50px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--edge);
  overflow: hidden;
}

.tool-bar .fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  transition: width .45s var(--ease);
}

.tool-bar--win .fill {
  background: linear-gradient(90deg, var(--pc2), var(--pc));
}

.tool-bar .num {
  text-align: right;
  color: var(--text-2);
}

/* ---------- Sample chooser ---------- */
.tool-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tool-samples button {
  appearance: none;
  cursor: pointer;
  background: rgba(163, 230, 53, .07);
  border: 1px solid rgba(163, 230, 53, .26);
  color: #cbe98a;
  border-radius: 50px;
  padding: 6px 13px;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .06em;
  transition: background .2s, border-color .2s;
}

.tool-samples button:hover {
  background: rgba(163, 230, 53, .14);
  border-color: rgba(163, 230, 53, .5);
}

/* ---------- Provenance strip ---------- */
.tool-source {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 14px 18px;
  border: 1px solid var(--edge);
  border-left: 3px solid var(--pc);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .028);
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.tool-source code {
  color: var(--text-2);
  background: rgba(0, 0, 0, .4);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: .7rem;
}

.tool-source .dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 12px var(--live);
  flex: none;
}

.tool-source .dot-live.is-local {
  background: var(--warn);
  box-shadow: 0 0 12px var(--warn);
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .tool-meter {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-editor {
    min-height: 300px;
  }

  .tool-bar {
    grid-template-columns: 100px 1fr 78px;
    gap: 10px;
    font-size: .64rem;
  }
}

@media (max-width: 560px) {
  .tool-meter {
    grid-template-columns: 1fr;
  }

  .tool-actions {
    gap: 6px;
  }

  .tool-btn {
    padding: 8px 12px;
    font-size: .68rem;
  }
}
