/* Parts Explorer final finish — Precision Assembly Bay / Blueprint Tidal Field
   Namespace .tt-px — only these selectors; no global resets.
   Loaded on combine-harvester-parts (EN) and vi/phu-tung-may-gat-dap (VI).
   State: data-state ∈ {loading, switching, animated, static, error}.
   Render mode: data-render-mode ∈ {poster, layers}. */

.tt-px { position: relative; }

/* Compatibility anchor for hero CTA scroll target (do not remove) */
.tt-px__anchor { display: block; scroll-margin-top: 96px; }

/* Section spacing */
.tt-px {
  padding-top: clamp(24px, 4vw, 72px);
  padding-bottom: 20px;
}
.tt-px + #catalog.section { padding-top: 48px; }
.tt-px__head { margin-bottom: clamp(16px, 2.5vw, 28px); }
.tt-px__kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.tt-px__heading {
  font-family: var(--font-d);
  font-weight: 800;
  font-size: clamp(30px, 3.2vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 14px;
}
.tt-px__note {
  font-size: clamp(13.5px, 1.4vw, 15px);
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 720px;
  margin: 0;
}

/* Desktop >= 1180px: vertical selector + viewer (288 + 856 = 1144 inner) */
.tt-px__shell {
  display: grid;
  grid-template-columns: 288px 1fr;
  gap: 0;
  background: #f5f7f9;
  border: 1px solid #dde2e7;
  border-radius: 22px;
  box-shadow: var(--shadow-lg, 0 18px 42px -28px rgba(22,24,29,0.18));
  overflow: hidden;
  position: relative;
  min-height: 604px;
}

.tt-px__tabs {
  background: #172334;
  color: #fff;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  margin: 0;
}
.tt-px__tab {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: transparent;
  border: 0;
  color: #aeb8c6;
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  min-height: 44px;
  min-width: 44px;
}
.tt-px__tab:hover { background: rgba(255,255,255,0.04); color: #fff; }
.tt-px__tab[aria-selected="true"] {
  background: rgba(255,255,255,0.08);
  color: #fff;
  position: relative;
}
.tt-px__tab:focus-visible { outline: 3px solid #d4a73c; outline-offset: 3px; }
.tt-px__tab-index {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #aeb8c6;
  font-variant-numeric: tabular-nums;
}
.tt-px__tab[aria-selected="true"] .tt-px__tab-index { color: #d4a73c; }
.tt-px__tab-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Viewer */
.tt-px__panel {
  display: grid;
  grid-template-rows: 1fr 96px;
  background: #f5f7f9;
  position: relative;
}
.tt-px__viewport {
  position: relative;
  isolation: isolate;
  --tt-px-drag-x: 0px;
  width: 100%;
  height: 508px;
  overflow: hidden;
  background: #f5f7f9;
  background-image:
    linear-gradient(to right, rgba(39,59,148,0.030) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(39,59,148,0.030) 1px, transparent 1px);
  background-size: 32px 32px;
  touch-action: pan-y pinch-zoom;
}

.tt-px__viewport > .tt-px__wave:first-child {
  position: absolute;
  inset: -10% -7% -18%;
  z-index: 0;
  display: block;
  width: 114%;
  height: 128%;
  max-width: none;
  max-height: none;
  pointer-events: none;
}

/* Static poster + assembly host — share 84% centered square */
.tt-px__static, .tt-px__assembly-host {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform: translate3d(var(--tt-px-drag-x), 0, 0);
}
.tt-px__static { z-index: 2; pointer-events: none; }
.tt-px__static.is-hidden { visibility: hidden; }
.tt-px__static img {
  width: 84%;
  height: 84%;
  max-width: 84%;
  max-height: 84%;
  object-fit: contain;
  display: block;
}
.tt-px__assembly-host { z-index: 3; pointer-events: none; }
.tt-px__assembly { position: relative; width: 100%; height: 100%; display: block; }
.tt-px__group {
  position: absolute;
  will-change: transform;
  transform: translate3d(0,0,0);
  backface-visibility: hidden;
}
.tt-px__fragment { position: absolute; pointer-events: none; user-select: none; }
.tt-px__fragment img {
  display: block;
  width: 100%; height: auto;
  object-fit: contain;
}

.tt-px__status {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Meta row */
.tt-px__meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #dde2e7;
  background: #fff;
  min-height: 96px;
}
.tt-px__family-name {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.tt-px__family-name a {
  font-family: var(--font-d);
  font-weight: 700;
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.15;
  color: var(--ink);
  text-decoration: none;
}
.tt-px__family-name a:hover { color: var(--blue, #273b94); }
.tt-px__family-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
  color: var(--blue, #273b94);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.tt-px__family-link:focus-visible { outline: 3px solid #d4a73c; outline-offset: 3px; }
.tt-px__family-link .ic { width: 14px; height: 14px; }

.tt-px__other { display: none !important; }

/* Tablet 768-1179px: horizontal rail above viewer */
@media (max-width: 1179px) and (min-width: 768px) {
  .tt-px__shell {
    grid-template-columns: 1fr;
    min-height: 604px;
  }
  .tt-px__tabs {
    flex-direction: row;
    overflow-x: auto;
    padding: 4px 12px;
    gap: 4px;
    height: 60px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .tt-px__tab {
    grid-template-columns: auto;
    grid-template-rows: auto auto;
    padding: 8px 14px;
    flex: 0 0 auto;
    min-width: 96px;
    min-height: 44px;
  }
  .tt-px__tab[aria-selected="true"] { background: rgba(255,255,255,0.12); }
  .tt-px__tab-name { font-size: 12px; }
  .tt-px__viewport {
    height: clamp(440px, 50vw, 512px);
    background-size: 32px 32px;
  }
  .tt-px__panel { grid-template-rows: 1fr 104px; }
}

/* Mobile <= 767px: horizontal six-item numeric rail, stage and compact meta */
@media (max-width: 767px) {
  .tt-px { padding-top: 24px; padding-bottom: 12px; }
  .tt-px + #catalog.section { padding-top: 32px; }
  .tt-px__head { margin-bottom: 16px; }
  .tt-px__shell {
    grid-template-columns: 1fr;
    grid-template-rows: 52px 1fr auto;
    width: calc(100vw - 40px);
    margin-inline: auto;
    min-height: 0;
  }
  .tt-px__tabs {
    grid-row: 1;
    flex-direction: row;
    overflow-x: auto;
    padding: 4px;
    gap: 4px;
    height: 52px;
    scrollbar-width: none;
  }
  .tt-px__tabs::-webkit-scrollbar { display: none; }
  .tt-px__tab {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding: 0;
    justify-items: center;
    align-items: center;
    min-width: 44px;
    min-height: 44px;
    width: calc((100% - 24px) / 6);
    flex: 0 0 auto;
  }
  .tt-px__tab-name { display: none; }
  .tt-px__tab-index { font-size: 11px; }
  .tt-px__panel { grid-row: 2; grid-template-rows: 1fr; }
  .tt-px__viewport {
    height: auto;
    aspect-ratio: 1 / 1;
    background-size: 44px 44px;
    background-image:
      linear-gradient(to right, rgba(39,59,148,0.04) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(39,59,148,0.04) 1px, transparent 1px);
  }
  .tt-px__static img, .tt-px__fragment img {
    width: 84%; height: 84%; max-width: 84%; max-height: 84%;
  }
  .tt-px__meta {
    grid-row: 3;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 8px;
    padding: 12px 16px;
    min-height: 104px;
  }
  .tt-px__family-name a { font-size: 18px; }
}

/* Narrow mobile (360x800) */
@media (max-width: 380px) {
  .tt-px__shell { width: calc(100vw - 40px); }
  .tt-px__tab { padding: 0; }
}

/* Render-mode fallback: hide assembly host when poster is active, hide poster when layers are active */
.tt-px[data-render-mode="poster"] .tt-px__assembly-host { display: none; }
.tt-px[data-render-mode="layers"] .tt-px__static { visibility: hidden; }

/* States */
.tt-px[data-state="loading"] .tt-px__viewport { background-color: #eef2f5; }
.tt-px[data-state="error"] .tt-px__viewport { background-color: #fff5f0; }
.tt-px.is-dragging { user-select: none; cursor: grabbing; }
.tt-px.is-dragging .tt-px__viewport { cursor: grabbing; }
.tt-px.is-dragging .tt-px__static,
.tt-px.is-dragging .tt-px__assembly-host {
  transition: none;
  will-change: transform;
}
.tt-px.is-swipe-settling .tt-px__static,
.tt-px.is-swipe-settling .tt-px__assembly-host {
  transition: transform 200ms cubic-bezier(.22,1,.36,1);
  will-change: transform;
}

/* Static fallback (no JS) */
.tt-px:not(.is-ready) .tt-px__assembly-host { display: none; }
.tt-px.is-ready[data-render-mode="poster"] .tt-px__static { visibility: visible; }
.tt-px.is-ready[data-render-mode="layers"] .tt-px__static { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  .tt-px__group { transition: none !important; animation: none !important; }
}

/* Final-round geometry and visual direction: Continuous Precision Orbit.
   This block intentionally wins over the Round-2 geometry above. */
.tt-px__shell {
  grid-template-columns: 272px minmax(0, 1fr);
  height: clamp(500px, calc(100svh - 250px), 548px);
  min-height: 500px;
  border-color: #d9e0e7;
  box-shadow: 0 24px 64px -38px rgba(23, 35, 52, .42);
}

.tt-px__rail {
  z-index: 5;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  color: #fff;
  background: #172334;
}

.tt-px__tabs {
  justify-content: center;
  min-height: 0;
  padding: 14px 12px;
  gap: 4px;
}

.tt-px__tab {
  grid-template-columns: 30px minmax(0, 1fr);
  min-height: 52px;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.25;
}

.tt-px__tab[aria-selected="true"] { background: #29384c; }
.tt-px__tab-name { white-space: normal; overflow: visible; text-overflow: clip; }

.tt-px__panel {
  display: block;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.tt-px__viewport {
  height: 100%;
  background-color: #f5f7f9;
  /* Solar Wash: a static warm inspection field beneath the technical grid.
     The ellipse has no visible edge and adds no competing motion layer. */
  background-image:
    linear-gradient(to right, rgba(39,59,148,.030) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(39,59,148,.030) 1px, transparent 1px),
    radial-gradient(ellipse 40% 48% at 54.5% 51%,
      rgba(241,188,55,.155) 0%,
      rgba(239,181,40,.105) 31%,
      rgba(230,165,26,.050) 52%,
      rgba(230,165,26,.016) 65%,
      rgba(230,165,26,0) 74%);
  background-size: 32px 32px, 32px 32px, 100% 100%;
  background-repeat: repeat, repeat, no-repeat;
  contain: layout paint style;
}

.tt-px__viewport::before {
  content: none;
}

.tt-px__viewport::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 15% 13%;
  border: 1px dashed rgba(39, 59, 148, .16);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(39, 59, 148, .018);
  opacity: .72;
  transform: rotate(-7deg) scaleY(.62);
  pointer-events: none;
}

.tt-px__group {
  inset: 0;
  transform-origin: 0 0;
}

.tt-px .tt-px__fragment img {
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  -webkit-user-drag: none;
}

.tt-px__meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 80px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.025);
}

.tt-px__family-name { display: grid; gap: 5px; min-width: 0; }

.tt-px__family-step {
  color: #d4a73c;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: .14em;
  line-height: 1;
}

.tt-px__family-name .tt-px__family-link {
  display: inline-grid;
  grid-template-columns: minmax(0, auto) 17px;
  align-items: center;
  justify-content: start;
  gap: 7px;
  min-width: 0;
  color: #fff;
  font-family: var(--font-d);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -.01em;
  line-height: 1.2;
  text-decoration: none;
}

.tt-px__family-link span {
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.tt-px__family-link .ic { width: 16px; height: 16px; color: #d4a73c; }
.tt-px__family-name .tt-px__family-link:hover { color: #fff4d7; }

@media (max-width: 1179px) {
  .tt-px__shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 56px auto auto;
    height: auto;
    min-height: 0;
  }

  .tt-px__rail { display: contents; }

  .tt-px__tabs {
    grid-row: 1;
    flex-direction: row;
    justify-content: flex-start;
    height: 56px;
    padding: 4px 8px;
    overflow-x: auto;
  }

  .tt-px__tab {
    flex: 0 0 auto;
    grid-template-columns: auto minmax(0, 1fr);
    min-width: 112px;
    min-height: 48px;
    padding: 7px 11px;
    font-size: 12px;
  }

  .tt-px__panel { grid-row: 2; height: auto; }
  .tt-px__viewport { height: clamp(420px, 48vw, 500px); }
  .tt-px__viewport > .tt-px__wave:first-child {
    inset: -8% -10% -16%;
    width: 120%;
    height: 124%;
  }

  .tt-px__meta {
    grid-row: 3;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding: 10px 14px;
    border-top: 1px solid #dce3ea;
    background: #fff;
  }

  .tt-px__family-step { color: #98731e; }
  .tt-px__family-name .tt-px__family-link { color: #172334; font-size: 17px; }
  .tt-px__family-name .tt-px__family-link:hover { color: var(--blue, #273b94); }
}

@media (max-width: 767px) {
  .tt-px__anchor { scroll-margin-top: 88px; }
  .tt-px__shell {
    grid-template-rows: 48px auto auto;
    width: calc(100vw - 24px);
    margin-left: calc(50% - 50vw + 12px);
    margin-right: 0;
    border-radius: 18px;
    box-shadow: 0 18px 42px -28px rgba(23,35,52,.42);
  }

  .tt-px__tabs { height: 48px; padding: 2px 3px; gap: 2px; overflow: hidden; }

  .tt-px__tab {
    grid-template-columns: 1fr;
    flex: 1 1 0;
    justify-items: center;
    width: auto;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 12px;
  }

  .tt-px__tab-name {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tt-px__viewport {
    height: clamp(312px, 88vw, 344px);
    aspect-ratio: auto;
    background-image:
      linear-gradient(to right, rgba(39,59,148,.04) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(39,59,148,.04) 1px, transparent 1px),
      radial-gradient(ellipse 44% 46% at 54% 50%,
        rgba(241,188,55,.11) 0%,
        rgba(239,181,40,.072) 31%,
        rgba(230,165,26,.032) 52%,
        rgba(230,165,26,.010) 65%,
        rgba(230,165,26,0) 74%);
    background-size: 44px 44px, 44px 44px, 100% 100%;
    background-repeat: repeat, repeat, no-repeat;
  }
  .tt-px__viewport > .tt-px__wave:first-child {
    display: none !important;
  }

  .tt-px__viewport::after { display: none; }

  .tt-px__assembly-host { contain: layout paint style; }

  .tt-px__meta {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 8px;
    min-height: 64px;
    padding: 8px 12px;
  }

  .tt-px__family-name { gap: 4px; }
  .tt-px__family-step { font-size: 9px; letter-spacing: .12em; }
  .tt-px__family-name .tt-px__family-link {
    grid-template-columns: minmax(0, auto) 15px;
    gap: 5px;
    max-width: 100%;
    font-size: clamp(15.5px, 4.2vw, 17px);
    line-height: 1.15;
  }

  .tt-px__family-link .ic { width: 15px; height: 15px; }
}

@media (max-width: 370px) {
  .tt-px__meta { min-height: 64px; padding-inline: 9px; }
  .tt-px__family-name .tt-px__family-link { font-size: 15px; }
}
