/* HSH Design — the free tools. Loaded via $pageStyles on /tools pages only.
 *
 * The tool markup and JS came across from the platform largely unchanged, so
 * the class names below are the platform's (.card, .field, .dropzone, and so
 * on). What changed is the visual language: the app is a back office with
 * rounded panels, this site is hard rectangles and rules. Restyling the same
 * class names was far safer than renaming them across ~2,000 lines of JS that
 * queries the DOM.
 */

/* The copied markup contains inline `var(--line)` and `var(--accent)` — the
 * app's names for what this site calls --rule and --lime. Aliased rather than
 * find-and-replaced so a future re-sync from the app stays a straight copy. */
.tool-body {
  --line: var(--rule);
  --accent: var(--lime);
  --accent-dim: color-mix(in srgb, var(--lime) 30%, var(--paper));
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --sans: 'Archivo', Helvetica, Arial, sans-serif;
}

/* ---------- Page head ---------- */

.tool-head {
  padding: 56px 56px 44px;
  border-bottom: 2.5px solid var(--ink);
  display: grid;
  gap: 20px;
}

.tool-head__eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
}

.tool-head__title {
  font-size: 48px;
  line-height: 1.04;
  letter-spacing: -.026em;
  font-weight: 600;
  max-width: 20ch;
}

.tool-head__lede { font-size: 18px; line-height: 1.55; color: var(--muted); max-width: 58ch; }

/* The privacy claim. Structural, not a promise — so it gets a real plate. */
.tool-privacy {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 2px solid var(--ink);
  padding: 18px 20px;
  max-width: 70ch;
  margin-top: 4px;
}
.tool-privacy svg { flex: 0 0 26px; margin-top: 2px; }
.tool-privacy p { font-size: 15px; line-height: 1.5; }
.tool-privacy strong { font-weight: 600; }

/* ---------- The tool itself ---------- */

.tool-body { padding: 40px 56px 56px; }

.statusbar {
  padding: 9px 18px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  min-height: 34px;
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}
/* The bar only exists once there is something to say. Without this an
   untouched tool opens with a full-width black slab above it saying nothing. */
.statusbar:empty { display: none; }
.statusbar.ok { background: #2f5233; color: #f2f2ec; }
.statusbar.err { background: #7a2b1c; color: #f2f2ec; }

.card {
  background: var(--panel);
  border: 2px solid var(--ink);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 16px;
}

.hint { font-size: 14px; line-height: 1.5; color: var(--muted); margin-top: 8px; max-width: 62ch; }
.empty-state { font-size: 14px; color: var(--muted); padding: 14px 0; }

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  background: var(--paper);
  border: 2px solid var(--ink);
  color: var(--ink);
  padding: 11px 12px;
  font: 400 15px var(--sans);
}
.field textarea { resize: vertical; min-height: 76px; }
.field input[type="checkbox"], .field input[type="radio"] { accent-color: var(--lime); width: 17px; height: 17px; }

.field-row { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.field-row .field { flex: 1; margin-bottom: 0; min-width: 150px; }
.field-group { display: flex; flex-direction: column; gap: 10px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.action-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* Buttons reuse the site's .btn shape rather than the app's. */
button.primary, button.secondary {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 13px 18px;
  border: 2px solid var(--ink);
  cursor: pointer;
  background: none;
  color: var(--ink);
}
button.primary { background: var(--ink); color: var(--paper); }
button.primary:hover:not(:disabled) { background: var(--lime); color: #1a1a1a; border-color: var(--lime); }
button.secondary:hover:not(:disabled) { border-color: var(--lime); color: var(--lime); }
button.primary:disabled, button.secondary:disabled { opacity: .35; cursor: not-allowed; }

.dropzone {
  display: block;
  text-align: center;
  padding: 34px 20px;
  border: 2px dashed var(--rule);
  background: var(--paper);
  cursor: pointer;
  margin-top: 12px;
}
.dropzone:hover, .dropzone.drag-active { border-color: var(--lime); background: var(--accent-dim); }
.dropzone input { display: none; }
.dropzone .icon { font-size: 26px; margin-bottom: 6px; }
.dropzone .main-label { font-size: 16px; font-weight: 500; }
.dropzone .sub-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }

.radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--rule);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14.5px;
}
.radio-option.selected { border-color: var(--ink); background: var(--paper); }
.radio-option input { position: absolute; opacity: 0; pointer-events: none; }

/* ---------- Annotation canvas (Add Dimensions) ---------- */

.annot-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.zoom-group { display: inline-flex; border: 2px solid var(--ink); }
.zoom-group button {
  background: none;
  border: none;
  border-right: 1px solid var(--rule);
  color: var(--ink);
  padding: 9px 14px;
  cursor: pointer;
  font: 500 13px var(--mono);
}
.zoom-group button:last-child { border-right: 0; }
.zoom-group button:hover { background: var(--lime); color: #1a1a1a; }

.annot-scale, .annot-fs-scale {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.annot-scale input[type="range"], .annot-fs-scale input[type="range"] { accent-color: var(--lime); width: 110px; }
.annot-toolbar button.secondary { padding: 9px 13px; }

.annot-viewport {
  margin-top: 12px;
  overflow: auto;
  max-height: 70vh;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.annot-fs-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #1a1a1a;
  border-bottom: 1px solid #34342e;
}
.annot-fs-bar-bottom { border-bottom: none; border-top: 1px solid #34342e; }
.annot-fs-bar button.secondary { color: #f2f2ec; border-color: #f2f2ec; }
.annot-fs-bar button.secondary:hover { border-color: var(--lime); color: var(--lime); }
.annot-fs-bar .annot-fs-scale { color: #9d9585; }
.annot-fs-tools { display: flex; gap: 6px; }
.annot-fs-tool {
  background: none;
  border: 2px solid #34342e;
  color: #f2f2ec;
  padding: 7px 11px;
  cursor: pointer;
  font-size: 15px;
}
.annot-fs-tool.active { border-color: var(--lime); background: var(--lime); }
.annot-fs-slot { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; }

/* ---------- SEO / explanatory copy under the tool ---------- */

.tool-notes { border-top: 2.5px solid var(--ink); padding: 56px 56px 64px; }

.tool-notes__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-top: 40px;
  border-top: 1px solid var(--rule);
}

.tool-note {
  padding: 24px 32px 28px 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tool-note:nth-child(odd) { border-right: 1px solid var(--rule); }
.tool-note:nth-last-child(-n+2) { border-bottom: none; }
.tool-note h3 { font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.tool-note p { font-size: 15px; line-height: 1.55; color: var(--muted); max-width: 48ch; }

/* Quiet cross-sell at the foot of every tool. */
.tool-more {
  border-top: 2.5px solid var(--ink);
  background: var(--band);
  color: var(--on-band);
  padding: 44px 56px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.tool-more p { font-size: 17px; line-height: 1.5; max-width: 52ch; color: var(--on-band); }
.tool-more .btn { border-color: var(--on-band); color: var(--on-band); }
.tool-more .btn:hover { border-color: var(--lime); color: var(--lime); }

/* ---------- Tools index ---------- */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
}

.tool-card {
  padding: 30px 36px 34px 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}
.tool-card:nth-child(odd) { border-right: 1px solid var(--rule); }
.tool-card__name { font-size: 22px; font-weight: 600; letter-spacing: -.018em; }
.tool-card__desc { font-size: 15.5px; line-height: 1.55; color: var(--muted); max-width: 44ch; }
.tool-card__for {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .tool-head, .tool-body, .tool-notes, .tool-more { padding-left: 32px; padding-right: 32px; }
  .tool-head__title { font-size: 38px; }
}

@media (max-width: 760px) {
  .tool-head { padding: 36px 20px 30px; }
  .tool-head__title { font-size: 29px; }
  .tool-head__lede { font-size: 16px; }
  .tool-body { padding: 28px 20px 40px; }
  .tool-notes { padding: 36px 20px 44px; }
  .tool-more { padding: 32px 20px 36px; }

  /* Rule moves from right to bottom so the grids stay rule-divided. */
  .tool-notes__grid, .tools-grid { grid-template-columns: 1fr; }
  .tool-note, .tool-card { border-right: none !important; padding-right: 0; }
  .tool-note:nth-last-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .tool-note:last-child, .tool-card:last-child { border-bottom: none; }

  .card { padding: 18px; }
  .action-row .btn, .action-row button { width: 100%; }
  .tool-more { flex-direction: column; align-items: flex-start; }
}

/* ---------- Classes the tool scripts emit at runtime ----------
 *
 * These never appear in the page source, only in strings inside the tool JS,
 * so they are easy to miss when porting: the page looks finished until you
 * actually load a file and the results render unstyled. Checked with a script
 * that greps the JS for class="..." and diffs it against these stylesheets.
 */

.download-link {
  display: inline-block;
  background: var(--lime);
  color: #1a1a1a;
  border: 2px solid var(--ink);
  padding: 14px 20px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  margin-top: 8px;
}
.download-link:hover { color: #1a1a1a; background: var(--ink); color: var(--paper); }

/* Result rows: a thumbnail, a name, and controls on the right. */
.list-item, .letterhead-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.letterhead-preview img, .logo-thumb {
  max-width: 64px;
  max-height: 64px;
  object-fit: contain;
  background: var(--panel);
}
.li-info, .letterhead-preview > div:last-child { flex: 1; min-width: 0; }
.li-name, .lh-name { font-size: 15px; font-weight: 500; word-break: break-word; }
.lh-detail {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--muted);
  margin-top: 4px;
  word-break: break-word;
}
.li-controls { display: flex; gap: 8px; flex-shrink: 0; }

button.small, .small {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 7px 10px;
  border: 1.5px solid var(--rule);
  background: none;
  color: var(--ink);
  cursor: pointer;
}
button.small:hover { border-color: var(--lime); color: var(--lime); }
button.danger, .danger { color: var(--cut); border-color: var(--cut); }
button.danger:hover { background: var(--cut); color: var(--paper); }

/* The resolution verdict on a processed page. */
.quality-report-dpi {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.quality-report-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The photo queue in Add dimensions. */
.job-attachments-gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.job-attachment-thumb {
  position: relative;
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 4px;
}
.job-attachment-thumb img { width: 88px; height: 88px; object-fit: cover; display: block; }
.attachment-remove-btn {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 4px 6px;
}
.attachment-remove-btn:hover { background: var(--cut); }

/* openInputSheet() — the prompt for a measurement or a note. */
.input-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(18, 18, 17, .62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.input-sheet {
  background: var(--paper);
  border: 2.5px solid var(--ink);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.input-sheet h3 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; }
.input-sheet-field {
  width: 100%;
  background: var(--panel);
  border: 2px solid var(--ink);
  color: var(--ink);
  padding: 12px;
  font: 400 16px var(--sans);
}
.input-sheet-field:focus { outline: 2px solid var(--lime); outline-offset: 1px; }
textarea.input-sheet-field { min-height: 96px; resize: vertical; }
.input-sheet-actions { display: flex; gap: 10px; justify-content: flex-end; }
