/* ============================================================
   parts.css - Service Tools section (parts/index.html only)
   Per-tool "stacked" block: heading, full-width description, a row of
   [usage photo | 3D preview], then a row of CAD download links.
   Uses the site theme tokens (css/colors.css) so dark/light both work.
   ============================================================ */

.tool-intro {
  max-width: 72ch;
  margin: 0.5em auto 1.5em;
}
.tool-toc {
  margin: 0 auto 1.25em;
  font-size: smaller;
}

.tool {
  max-width: 1040px;
  margin: 0 auto 1.5em;
}
.tool:not(:first-of-type) {
  border-top: 1px solid var(--table-border);
  padding-top: 1.5em;
}
.tool-desc {
  max-width: 72ch;
  margin: 0.5em auto 1.25em;
  font-size: 90%;
}

/* a service tip/technique callout inside a tool block */
.tool-note {
  max-width: 72ch;
  margin: 0 auto 1.25em;
  padding: 0.6em 1.25em;
  border-left: 2px solid var(--table-border);
  border-radius: 0 4px 4px 0;
  text-align: left;
  font-size: smaller;
}

/* the [usage photo | 3D preview] row - wraps to one column when narrow */
.tool-media {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25em;
  justify-content: center;
  align-items: flex-start;
}
.tool-usage,
.tool-preview {
  flex: 1 1 400px;
  max-width: 492px;
  margin: 0 auto;
}
.tool-usage figcaption,
.tool-preview figcaption {
  margin-top: 0.4em;
  font-size: smaller;
  color: var(--footer-text);
  text-align: center;
}

/* placeholder until real usage photos exist (keeps the preview aligned) */
.usage-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 640 / 520;
  border: 1px dashed var(--table-border);
  border-radius: 2px;
  background: var(--table-bg);
  color: var(--footer-text);
  font-style: italic;
  text-align: center;
  padding: 1em;
  max-height: 400px;
  margin: 0 auto;
}

/* a real usage photo (portrait phone shots) - capped so it doesn't tower over
   the landscape preview beside it; centered in its column */
.tool-usage a {
  display: block;
}
.tool-usage img {
  display: block;
  max-width: 100%;
  max-height: 400px;
  width: auto;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: 1px 1px 4px 1px var(--imgshadow);
}

/* click-to-load 3D preview: static render + overlay badge, as a button */
.view3d {
  display: block;
  width: 100%;
  aspect-ratio: 640 / 520;       /* same shape as the live viewer -> no height jump on click */
  padding: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: none;
  cursor: pointer;
  box-shadow: 1px 1px 4px 1px var(--imgshadow);
}
.view3d img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.view3d-badge {
  position: absolute;
  left: 50%;
  bottom: 0.75em;
  transform: translateX(-50%);
  padding: 0.35em 0.95em;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: #ffffff;
  font-size: 90%;
  white-space: nowrap;
}
.view3d:hover .view3d-badge {
  background: var(--btn-bg-hover);
}

/* photo hover glow, matching the site's .banner / .model-thumb / .gallery */
.view3d,
.tool-usage img {
  transition: box-shadow 0.1s ease;
}
.view3d:hover,
.tool-usage img:hover {
  box-shadow:
    1px 1px 4px 0 var(--imgshadow),
    0 0 6px 1px var(--imgshadow);
}

/* the live viewer swapped in on click — SAME box as the static preview
   (same aspect-ratio, not a fixed px height) so the layout doesn't jump */
.viewer-live {
  position: relative;            /* anchors the loading overlay */
  width: 100%;
  aspect-ratio: 640 / 520;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  background: var(--table-bg);   /* themed panel instead of a bare bordered void */
  box-shadow: 1px 1px 4px 1px var(--imgshadow);
}
.viewer-live iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
/* opaque themed "Loading..." overlay shown over the iframe while the viewer
   (~4 MB of wasm/JS) downloads and boots - no blank box, no dark-mode white
   flash. parts.js removes it once the iframe paints. */
.viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--table-bg);
  color: var(--footer-text);
  font-style: italic;
  font-size: 1.5em;
  text-align: center;
  padding: 1em;
  transition: opacity 0.2s ease;
}

/* CAD download links row */
.cad-downloads {
  margin: 1em 0 0;
  text-align: center;
}
.cad-label {
  margin-right: 0.35em;
  color: var(--footer-text);
}
.cad-downloads a {
  display: inline-block;
  margin: 0 0.25em;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  text-decoration: none;
  box-shadow: 1px 1px 1px 0 var(--buttonborder);
}
.cad-downloads a:hover {
  text-decoration: none;
  background: var(--table-hover);
}
/* 3D pushdown on press, matching the site's native <button>:active */
.cad-downloads a:active {
  box-shadow: 1px 1px 1px 0 #222222 inset;
}

/* Mobile layout */
@media (max-width: 800px) {
  .tool-note {
    max-width: 40ch;
  }
}
