.joint-guide {
  --joint-ink: #20294f;
  --joint-muted: #59667a;
  --joint-line: #d7dce5;
  --joint-max-height: min(58vh, 540px);
  --joint-max-height: min(58svh, 540px);
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  color: var(--joint-ink);
  font-size: 16px;
  line-height: 1.6;
}
.joint-guide [hidden], .joint-lightbox [hidden] { display: none !important; }
.precast-joints-active main > footer { display: none; }
.precast-joints-active .heading { scroll-margin-top: 16px; }
.joint-viewer {
  background: #fff;
  border: 1px solid var(--joint-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 5px 22px rgb(32 41 79 / 4%);
}
.joint-guide button, .joint-lightbox button {
  min-height: 44px;
  margin: 0;
  border: 1px solid #bac4d3;
  border-radius: 8px;
  padding: 9px 14px;
  color: #20294f;
  background: #fff;
  box-shadow: none;
  font: 600 15px/1.35 Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}
.joint-guide button:hover, .joint-lightbox button:hover { background: #edf2f7; }
.joint-guide :is(button, a):focus-visible, .joint-lightbox :is(button, [tabindex]):focus-visible {
  outline: 3px solid #377fa8;
  outline-offset: 3px;
}
.joint-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 20px;
}
.joint-view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--joint-line);
  border-radius: 10px;
  background: #f1f3f7;
}
.joint-view-switch button { border: 0; background: transparent; padding: 8px 16px; }
.joint-view-switch button[aria-pressed="true"] { color: #fff; background: #20294f; }
.joint-toolbar .joint-label-toggle { border-color: transparent; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.joint-figure { margin: 0; }
.joint-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #e9edf1;
  border-block: 1px solid var(--joint-line);
}
.joint-image-wrap {
  position: relative;
  isolation: isolate;
  flex: 0 1 auto;
  width: min(100%, calc(var(--joint-max-height) * var(--joint-ratio, 1.3333333333)));
  aspect-ratio: var(--joint-ratio, 1.3333333333);
}
.joint-main-photo { display: block; width: 100%; height: 100%; object-fit: contain; }
.joint-guide .joint-photo-open {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}
.joint-guide .joint-photo-open:hover { background: transparent; }
.joint-photo-open:focus-visible { outline-offset: -4px !important; }
.joint-hotspots { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.joint-leader { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.joint-leader path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.joint-leader-halo { stroke: #fff; stroke-width: 4; }
.joint-leader-line { stroke: #8d3542; stroke-width: 1.75; }
.joint-guide .joint-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  pointer-events: auto;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}
.joint-guide .joint-hotspot:hover { background: transparent; }
.joint-hotspot > span, .joint-part-letter {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--part-ink, #9c414b);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
}
.joint-guide [data-part="upper"], .joint-guide [data-part-color="upper"] { --part-ink: #254e78; }
.joint-guide [data-part="lower"], .joint-guide [data-part-color="lower"] { --part-ink: #29695f; }
.joint-guide [data-part="joint"], .joint-guide [data-part-color="joint"] { --part-ink: #9c414b; }
.joint-hotspot > span { border: 2px solid #fff; box-shadow: 0 1px 6px #0009; }
.joint-hotspot[aria-pressed="true"] > span { outline: 2px solid #fff; outline-offset: 3px; }
.joint-caption { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 20px; }
.joint-guide h2 { margin: 0; color: var(--joint-ink); font-size: 20px; line-height: 1.35; letter-spacing: -.01em; }
.joint-caption p { margin: 6px 0 0; color: var(--joint-muted); font-size: 16px; }
.joint-guide .joint-enlarge { display: inline-flex; flex: none; align-items: center; gap: 9px; white-space: nowrap; }
.joint-enlarge svg { width: 18px; height: 18px; flex: none; }
.joint-thumbnails { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 0 20px 20px; }
.joint-guide .joint-thumbnail {
  min-width: 0;
  padding: 5px;
  border: 2px solid transparent;
  background: #f2f4f7;
  text-align: left;
  font-size: 14px;
}
.joint-thumbnail img { display: block; width: 100%; height: 78px; object-fit: cover; border-radius: 5px; }
.joint-thumbnail[data-photo="assembly"] img { object-position: 50% 54%; }
.joint-thumbnail span { display: block; padding: 7px 3px 3px; line-height: 1.3; }
.joint-guide .joint-thumbnail[aria-pressed="true"] { border-color: #34577f; background: #eaf0f7; }
.joint-parts { padding: 20px; background: #fafbfc; border-top: 1px solid var(--joint-line); }
.joint-parts-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.joint-parts-heading p { margin: 0; color: var(--joint-muted); font-size: 14px; }
.joint-part-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.joint-part-buttons button { display: flex; align-items: center; justify-content: center; gap: 9px; border: 2px solid #d8dfe8; padding: 9px; text-align: left; }
.joint-part-buttons button[aria-pressed="true"] { border-color: #34577f; background: #eaf0f7; }
.joint-explanation { min-height: 100px; margin-top: 16px; padding: 14px 16px; border-left: 3px solid var(--part-ink, #9c414b); background: #fff; }
.joint-explanation h3 { margin: 0; font-size: 17px; line-height: 1.4; color: var(--joint-ink); }
.joint-explanation p { margin: 5px 0 0; font-size: 16px; color: #46556b; }
.joint-notice { margin-top: 24px; padding: 0 4px; max-width: 800px; }
.joint-notice p { margin: 9px 0; color: #46556b; font-size: 16px; }
.joint-notice a { display: inline-block; padding: 8px 0; color: #305a85; text-underline-offset: 4px; font-weight: 600; }
.joint-photo-error { padding: 30px 18px; text-align: center; color: #76232b; }
.joint-photo-error button { display: block; margin: 12px auto 0; }
.joint-lightbox {
  width: min(1140px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 20px;
  margin: auto;
  border: 1px solid #9eabba;
  border-radius: 13px;
  color: #20294f;
  background: #fff;
  box-sizing: border-box;
}
.joint-lightbox[open] { display: flex; flex-direction: column; gap: 12px; }
.joint-lightbox::backdrop { background: rgb(13 21 39 / 82%); }
.joint-lightbox-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex: none; }
.joint-lightbox-top h2 { margin: 0; font: 650 19px/1.35 Inter, "Segoe UI", Arial, sans-serif; }
.joint-lightbox-top button { flex: none; }
.joint-lightbox-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; flex: none; }
.joint-lightbox-tools > button { min-width: 44px; padding: 7px; }
.joint-lightbox-tools > .joint-fit { padding: 7px 12px; }
.joint-lightbox-tools output { min-width: 5ch; text-align: center; color: #20294f; font-size: 15px; font-variant-numeric: tabular-nums; }
.joint-lightbox-tools > span { margin-left: auto; font-size: 14px; color: #59667a; }
.joint-lightbox button:disabled { opacity: .4; cursor: default; background: #f0f2f5; }
.joint-zoom-viewport { min-height: 100px; height: min(67vh, 780px); height: min(67dvh, 780px); flex: 1 1 auto; overflow: auto; background: #e9edf1; border-radius: 7px; overscroll-behavior: contain; cursor: grab; }
.joint-zoom-viewport.is-panning { cursor: grabbing; }
.joint-zoom-photo { display: block; max-width: none; margin: 0 auto; user-select: none; }
.joint-lightbox-caption { flex: none; margin: 0; font-size: 14px; line-height: 1.5; color: #59667a; }
@media (max-width: 650px) {
  .joint-guide { --joint-max-height: min(53vh, 440px); --joint-max-height: min(53svh, 440px); }
  .joint-toolbar { padding: 12px; gap: 6px; }
  .joint-view-switch { padding: 3px; }
  .joint-view-switch button { padding: 7px 9px; font-size: 14px; }
  .joint-toolbar .joint-label-toggle { padding-inline: 4px; font-size: 14px; }
  .joint-caption { flex-direction: column; gap: 12px; padding: 16px 14px; }
  .joint-guide h2 { font-size: 19px; }
  .joint-caption .joint-enlarge { align-self: flex-start; }
  .joint-thumbnails { gap: 6px; padding: 0 12px 16px; }
  .joint-guide .joint-thumbnail { padding: 3px; font-size: 14px; }
  .joint-thumbnail img { height: 52px; }
  .joint-thumbnail span { padding: 6px 1px 3px; text-align: center; }
  .joint-parts { padding: 16px 12px; }
  .joint-part-buttons { gap: 6px; }
  .joint-part-buttons button { flex-direction: column; gap: 6px; font-size: 14px; padding: 8px 4px; text-align: center; }
  .joint-explanation { padding: 12px; }
  .joint-lightbox { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 12px; gap: 10px; }
  .joint-lightbox-top h2 { font-size: 17px; }
  .joint-lightbox-tools > span { flex: 1 0 100%; margin: 0; }
}
@media (max-width: 360px) {
  .joint-thumbnails { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .joint-thumbnail img { height: 66px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .joint-guide { --joint-max-height: 62vh; --joint-max-height: 62svh; }
  .joint-lightbox { padding: 10px 14px; }
  .joint-lightbox[open] { gap: 8px; }
  .joint-lightbox-top h2 { font-size: 16px; }
  .joint-lightbox-tools > span, .joint-lightbox-caption { display: none; }
  .joint-zoom-viewport { min-height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .joint-guide *, .joint-lightbox * { scroll-behavior: auto; transition: none; }
}
