/**
 * Hook Builder — research-dossier skin.
 *
 * Loaded alongside gw-hook-dossier.css, which supplies the tokens, page header,
 * and type scale. Like the Print Lab this is a tool rather than a document, so
 * the body is a workbench: the two silhouettes side by side over the controls
 * that drive them.
 *
 * IMPORTANT — the page script toggles panels with `style.display = '' | 'none'`
 * and rows with `style.display = 'flex' | 'none'`, so any row the script can
 * show must lay out correctly as a flex row. Tab and chip state is carried by
 * classes (.is-active, .is-changed) rather than written as inline style, so
 * appearance stays in this file.
 *
 * @since 1.7.21
 */

/* The dossier header reserves a column for a hook silhouette; the builder has
   none of its own, so the header runs full width. */
html body .gw-entry.gw-dossier.gw-hook-builder-page > .gw-page-header {
  grid-template-columns: minmax(0, 1fr) !important;
  min-height: 0 !important;
  padding-bottom: 14px !important;
}

#hc-hook-builder { color: var(--gwd-ink); font-family: var(--gwd-sans); }

/* ── Density ───────────────────────────────────────────────────────────────
   The document skin gives each section 52px of air top and bottom. That reads
   well on a page you scroll through and badly on a tool: it pushes the sliders
   off screen, so you cannot see what a control does while you move it. The
   sections here are tightened to keep the silhouettes and the controls in view
   together. */
html body .gw-entry.gw-dossier.gw-hook-builder-page .gw-section {
  padding: 14px 0 !important;
}
/* The page ends at the actions; the skin's 90px footer well is pure scroll. */
html body .gw-entry.gw-dossier.gw-hook-builder-page {
  padding-bottom: 22px !important;
}
/* The search leads the page; it needs no air above it. */
html body .gw-entry.gw-dossier.gw-hook-builder-page .gw-section:first-of-type {
  padding-top: 0 !important;
}
/* Nothing follows the actions, so the trailing rule and its air only add
   scroll. */
html body .gw-entry.gw-dossier.gw-hook-builder-page .gw-section:last-of-type {
  padding-bottom: 0 !important;
  border-bottom: 0 !important;
}
html body .gw-entry.gw-dossier.gw-hook-builder-page .gw-section > h2.gw-section-title {
  margin: 0 0 14px !important;
}

/* ── Search ────────────────────────────────────────────────────────────────── */
.hb-search-block { padding: 0; }
.hb-search-label {
  display: block;
  margin-bottom: 7px;
  color: var(--gwd-faint);
  font: 850 8px/1 var(--gwd-sans);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.hb-search-row { display: flex; align-items: center; gap: 12px; }
html body .gw-entry.gw-dossier #hcb-search {
  flex: 1;
  min-width: 0;
  max-width: none;
  min-height: 42px;
  padding: 0 14px;
  color: var(--gwd-ink);
  background: var(--gwd-light);
  border: 1px solid var(--gwd-line-strong);
  border-radius: 0;
  box-shadow: none;
  font: 14px/1 var(--gwd-serif);
}
#hcb-search:focus-visible { outline: 2px solid var(--gwd-orange); outline-offset: 1px; }
#hcb-search-status { flex-shrink: 0; color: var(--gwd-faint); font: 9px/1.3 var(--gwd-sans); white-space: nowrap; }

#hcb-results { position: relative; z-index: 50; }
#hcb-results-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: var(--gwd-surface);
  border: 1px solid var(--gwd-line);
  border-top: 0;
  box-shadow: 0 6px 18px rgba(21, 28, 26, .12); /* theme: fixed */
}
.hb-row { padding: 9px 14px; border-bottom: 1px solid var(--gwd-line-soft); cursor: pointer; }
.hb-row:last-child { border-bottom: 0; }
.hb-row:hover, .hb-row:focus-visible { background: var(--gwd-light); }
.hb-row-name { color: var(--gwd-ink); font: 600 13px/1.3 var(--gwd-sans); }
.hb-row-meta { margin-top: 2px; color: var(--gwd-faint); font: 10px/1.3 var(--gwd-sans); }
/* A hook whose bend family lacks enough synced artwork cannot be built from. */
.hb-row.is-disabled { cursor: default; opacity: .45; }
.hb-row.is-disabled:hover { background: transparent; }
.hb-row.is-disabled .hb-row-name { color: var(--gwd-dim); }
.hb-row-warn { margin-top: 2px; color: var(--gwd-warn-fg); font: 10px/1.3 var(--gwd-sans); }
.hb-row-note { padding: 7px 14px; color: var(--gwd-faint); font: 10px/1.3 var(--gwd-sans); }

/* ── Preview stage ─────────────────────────────────────────────────────────── */
.hb-stage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hb-stage-col { min-width: 0; }
.hb-stage-label {
  margin: 0 0 7px;
  color: var(--gwd-faint);
  font: 850 8px/1 var(--gwd-sans);
  letter-spacing: .09em;
  text-transform: uppercase;
}
/* The identity sits on the label line rather than under the plate. */
.hb-stage-label span {
  color: var(--gwd-text2);
  font: 500 10px/1 var(--gwd-sans);
  letter-spacing: 0;
  text-transform: none;
}
/* The graph rule under each silhouette reads as drafting paper and makes a
   proportion change legible without measuring it.

   Height is fixed, not min-height: the left plate holds an <img> that sizes to
   its artwork while the right holds a fixed-height <svg>, so a minimum let the
   two plates settle at different heights and the grids stopped lining up. */
.hb-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 208px;
  padding: 14px;
  /* A plate is a DRAWING (a black hook and its coloured handles on a measuring grid), so it keeps a light ground in both
     themes, like the scale preview: `--gwd-plate` is the same cream either way. */
  background-color: var(--gwd-plate);
  background-image:
    linear-gradient(to right, rgba(25, 75, 66, .10) 1px, transparent 1px), /* theme: fixed */
    linear-gradient(to bottom, rgba(25, 75, 66, .10) 1px, transparent 1px); /* theme: fixed */
  background-size: 18px 18px;
  border: 1px solid var(--gwd-line);
  overflow: hidden;
}
/* Both fill the plate, so the artwork scales with it and the two stay level. */
.hb-plate img { max-width: 100%; max-height: 100%; object-fit: contain; }
.hb-plate svg { height: 100%; max-height: 100%; overflow: visible; }

/* ── Chips ─────────────────────────────────────────────────────────────────── */
.hb-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0 0; }
.hb-chip {
  padding: 4px 10px;
  color: var(--gwd-text2);
  background: var(--gwd-wash);
  border: 1px solid var(--gwd-line);
  font: 10px/1.4 var(--gwd-sans);
  letter-spacing: .02em;
}
/* A value the tyer has moved off its cataloged figure. */
.hb-chip.is-changed {
  color: var(--gwd-orange-deep);
  background: var(--gwd-orange-bg);
  border-color: var(--gwd-orange);
  font-weight: 700;
}

/* ── Provenance ────────────────────────────────────────────────────────────── */
/* A design is a modification of a catalog record. On a reference site that
   distinction has to survive being exported or shared, so it is stated on the
   page rather than left to the reader. */
.hb-provenance { margin: 9px 0 0; color: var(--gwd-faint); font: 11px/1.5 var(--gwd-serif); }
.hb-provenance.is-modified { color: var(--gwd-orange-deep); }
.hb-provenance:empty { display: none; }

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.hb-tabs {
  display: flex;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--gwd-line);
  overflow-x: auto;
}
html body .gw-entry.gw-dossier .hb-tab {
  flex: 1;
  min-width: 78px;
  padding: 10px 8px;
  color: var(--gwd-faint);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font: 850 9px/1.2 var(--gwd-sans);
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
}
html body .gw-entry.gw-dossier .hb-tab:hover { color: var(--gwd-ink); }
html body .gw-entry.gw-dossier .hb-tab.is-active {
  color: var(--gwd-ink);
  border-bottom-color: var(--gwd-orange);
}

.hb-panel { max-width: 560px; }

/* ── Control rows ──────────────────────────────────────────────────────────── */
/* Rows the script toggles are display:flex when shown — see the file header. */
.hb-field { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.hb-field label {
  flex-shrink: 0;
  width: 108px;
  color: var(--gwd-text2);
  font: 11px/1.3 var(--gwd-sans);
}
.hb-field input[type="range"] { flex: 1; min-width: 0; accent-color: var(--gwd-orange); }
html body .gw-entry.gw-dossier .hb-field select {
  flex: 1;
  min-width: 0;
  width: auto !important;
  min-height: 34px;
  padding: 0 10px;
  color: var(--gwd-ink);
  background: var(--gwd-surface);
  border: 1px solid var(--gwd-line-strong);
  border-radius: 0;
  font: 12px/1 var(--gwd-sans);
}
.hb-out {
  flex-shrink: 0;
  width: 84px;
  color: var(--gwd-faint);
  font: 10px/1.3 var(--gwd-sans);
  text-align: right;
}
.hb-note { margin: 0; color: var(--gwd-faint); font: 11px/1.6 var(--gwd-serif); }
.hb-note em { color: var(--gwd-text2); }

.hb-recorded { margin-top: 14px; border-top: 1px solid var(--gwd-line); padding-top: 10px; }
.hb-recorded dt {
  color: var(--gwd-faint);
  font: 850 8px/1 var(--gwd-sans);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.hb-recorded dd { margin: 5px 0 0; color: var(--gwd-ink); font: 12px/1.4 var(--gwd-sans); }

/* ── Actions ───────────────────────────────────────────────────────────────── */
.hb-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--gwd-line);
}
html body .gw-entry.gw-dossier .hb-btn {
  padding: 9px 15px;
  color: var(--gwd-ink);
  background: var(--gwd-surface);
  border: 1px solid var(--gwd-line-strong);
  border-radius: 0;
  font: 850 9px/1.2 var(--gwd-sans);
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
}
html body .gw-entry.gw-dossier .hb-btn:hover { background: var(--gwd-light); }
html body .gw-entry.gw-dossier .hb-btn.is-primary {
  color: #fff; /* theme: fixed */
  background: var(--gwd-bar-bg);
  border-color: var(--gwd-rule);
}
html body .gw-entry.gw-dossier .hb-btn.is-primary:hover { background: var(--gwd-bar-bg); }

.hb-units { display: inline-flex; align-items: center; gap: 6px; }
.hb-units-label { color: var(--gwd-faint); font: 850 8px/1 var(--gwd-sans); letter-spacing: .09em; text-transform: uppercase; }
html body .gw-entry.gw-dossier .hb-units button {
  min-width: 38px;
  padding: 7px 9px;
  color: var(--gwd-text2);
  background: var(--gwd-surface);
  border: 1px solid var(--gwd-line-strong);
  border-radius: 0;
  font: 850 9px/1.2 var(--gwd-sans);
  text-transform: uppercase;
  cursor: pointer;
}
html body .gw-entry.gw-dossier .hb-units button.is-active {
  color: #fff; /* theme: fixed */
  background: var(--gwd-bar-bg);
  border-color: var(--gwd-rule);
}

/* Stated explicitly: the theme's link colour would otherwise win here. */
html body .gw-entry.gw-dossier a.hb-ref-link {
  margin-left: auto;
  color: var(--gwd-ink) !important;
  border-bottom: 1px solid var(--gwd-orange);
  font: 850 9px/1.2 var(--gwd-sans);
  letter-spacing: .07em;
  text-decoration: none;
  text-transform: uppercase;
}
html body .gw-entry.gw-dossier a.hb-ref-link:hover { color: var(--gwd-orange) !important; }

.hb-status { margin-top: 22px; color: var(--gwd-faint); font: 12px/1.5 var(--gwd-serif); }
.hb-status.is-error { color: var(--gwd-bad-fg); }

/* ── Narrow ────────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .hb-stage { grid-template-columns: minmax(0, 1fr); }
  .hb-field { flex-wrap: wrap; }
  .hb-field label { width: 100%; }
  .hb-out { width: auto; margin-left: auto; }
  .hb-ref-link { margin-left: 0 !important; }
}
