/* Styles for the interactive panel on /tools/ pages. Page furniture comes from
   styles.css - this file only adds the parts that do work. */

.tool-panel {
  margin-bottom: 80px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--ink-raised);
}

.tool-panel-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.dropzone {
  position: relative;
  border: 1px dashed rgba(242, 237, 230, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 240ms ease, background 240ms ease;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--amber);
  background: rgba(232, 163, 61, 0.06);
}

.dropzone:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.24);
}

.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.dropzone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 54px 24px;
  text-align: center;
  cursor: pointer;
}

.dropzone-mark svg {
  width: 40px;
  height: 40px;
  margin-bottom: 6px;
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dropzone-title {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.dropzone-hint {
  color: var(--muted);
  font-size: 13px;
}

.tool-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 24px;
}

.tool-control label {
  display: block;
  margin-bottom: 10px;
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Both controls must render identically, and left to itself the browser will
   not do that: Safari applies its own intrinsic metrics to native form
   controls, so a select and a number input with the same min-height still come
   out different heights. appearance:none takes that decision away, at the cost
   of having to draw the select's chevron ourselves. */
.tool-control select,
.tool-control input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background-color: var(--ink-soft);
  color: var(--paper);
  font-family: inherit;
  font-size: 14px;
  line-height: 46px;
}

/* Chevron drawn in the stylesheet, since appearance:none removes the native one. */
.tool-control select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23a69d92' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 18px 18px;
}

/* The spinner adds nothing to a pixel dimension and is another thing browsers
   size differently. */
.tool-control input[type="number"] { -moz-appearance: textfield; }
.tool-control input[type="number"]::-webkit-outer-spin-button,
.tool-control input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tool-control select:focus-visible,
.tool-control input:focus-visible {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.24);
}

.tool-control-hint {
  margin: 9px 0 0;
  color: var(--muted-dark);
  font-size: 12px;
  line-height: 1.5;
}

.tool-status {
  margin: 24px 0 0;
  padding-left: 18px;
  position: relative;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.tool-status::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-dark);
}

.tool-status[data-kind="busy"]::before { background: var(--amber); animation: breathe 1.4s ease-in-out infinite; }
.tool-status[data-kind="done"]::before { background: #5fbf7f; }
.tool-status[data-kind="error"]::before { background: #d9704e; }
.tool-status[data-kind="error"] { color: var(--paper); }

.tool-results:not(:empty) { margin-top: 24px; display: grid; gap: 16px; }

.tool-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
}

.tool-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.tool-card-row .button { flex-shrink: 0; }
.tool-card-error { border-color: rgba(217, 112, 78, 0.5); }

.tool-card-name {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.tool-card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tool-preview {
  margin: 0 0 22px;
  border-radius: 13px;
  overflow: hidden;
  background: var(--ink);
}

.tool-preview img {
  width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: contain;
}

.fact-list {
  display: grid;
  grid-template-columns: minmax(0, 34%) minmax(0, 1fr);
  gap: 0;
  margin: 0;
}

.fact-list dt,
.fact-list dd {
  margin: 0;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.fact-list dt { color: var(--muted-dark); }
.fact-list dd { color: var(--paper); }
.fact-list dt:first-of-type, .fact-list dd:first-of-type { border-top: 0; }

.tool-note {
  margin: 18px 0 0;
  padding: 15px 17px;
  border-left: 2px solid var(--amber);
  background: rgba(232, 163, 61, 0.07);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.65;
}

.tool-footnote {
  margin: 0;
  color: var(--muted-dark);
  font-size: 12px;
  line-height: 1.6;
}

.tool-privacy {
  display: flex;
  gap: 10px;
  margin: 26px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted-dark);
  font-size: 12px;
  line-height: 1.65;
}

.tool-privacy span { color: var(--amber); font-size: 8px; line-height: 2.4; }

.tool-panel.is-busy { pointer-events: none; }
.tool-panel.is-busy .dropzone { opacity: 0.6; }

.lang-switch {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.lang-switch-label {
  display: block;
  margin-bottom: 14px;
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lang-switch ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lang-switch a,
.lang-switch span[aria-current] {
  display: inline-block;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}

.lang-switch a {
  color: var(--muted);
}

.lang-switch a:hover,
.lang-switch a:focus-visible {
  border-color: rgba(232, 163, 61, 0.45);
  background: rgba(255, 255, 255, 0.04);
  color: var(--paper);
}

.lang-switch span[aria-current] {
  border-color: var(--amber);
  color: var(--paper);
}

@media (max-width: 900px) {
  .tool-panel { padding: 24px; }
  .tool-controls { grid-template-columns: 1fr; gap: 18px; }
  .dropzone-label { padding: 40px 18px; }
  .tool-card-row .button { width: 100%; }
  .fact-list { grid-template-columns: 1fr; }
  .fact-list dt { padding-bottom: 0; border-top: 1px solid var(--line); }
  .fact-list dd { padding-top: 4px; border-top: 0; }
  .fact-list dt:first-of-type { border-top: 0; }
}

/* Quality-preview results. A real table, because the reader is comparing four
   numbers against each other and against the original. */
.tool-table {
  width: 100%;
  margin-top: 22px;
  border-collapse: collapse;
  font-size: 14px;
}

.tool-table caption {
  padding-bottom: 14px;
  color: var(--muted-dark);
  text-align: left;
  font-size: 12px;
  line-height: 1.5;
}

.tool-table th,
.tool-table td {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.tool-table thead th {
  padding-top: 0;
  border-top: 0;
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tool-table tbody th { color: var(--paper); font-weight: 600; }
.tool-table td { color: var(--muted); font-variant-numeric: tabular-nums; }
.tool-table td:last-child { text-align: right; }
.tool-table-original th, .tool-table-original td { color: var(--muted-dark); }

/* Batch bar sits above the per-file rows; the CTA sits below everything, since
   it only earns attention once the tool has actually delivered something. */
.tool-batch { border-color: rgba(232, 163, 61, 0.35); }

.tool-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-color: rgba(232, 163, 61, 0.35);
  background: rgba(232, 163, 61, 0.07);
}

.tool-cta .button { flex-shrink: 0; }

.tool-cta-title {
  margin: 0 0 6px;
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.tool-batch button.button,
.tool-cta .button { border: 0; cursor: pointer; }
.tool-batch button.button[disabled] { opacity: 0.65; cursor: default; }

@media (max-width: 900px) {
  .tool-cta .button, .tool-batch button.button { width: 100%; }
}
