.ktw-product-model-host {
  isolation: isolate;
  position: relative;
}

.ktw-product-model-viewer {
  background: transparent;
  border: 0;
  border-radius: 0;
  display: grid;
  grid-template-rows: auto auto;
  inset: 0;
  min-height: 100%;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  transition: opacity .22s ease;
  visibility: hidden;
  z-index: 2;
}

.ktw-product-model-host--active {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

.ktw-product-model-host--active > img,
.ktw-product-model-host--active > picture {
  display: none !important;
}

.ktw-product-model-host--active > .ktw-product-model-viewer,
.ktw-product-model-dialog .ktw-product-model-viewer {
  inset: auto;
  min-height: 0;
  opacity: 1;
  overflow: visible;
  pointer-events: auto;
  position: relative;
  visibility: visible;
}

.ktw-product-model-viewer__canvas {
  background: transparent;
  border-radius: 0;
  height: clamp(320px,38vw,520px);
  min-height: 320px;
  width: 100%;
  --poster-color: transparent;
}

.ktw-product-model-viewer__controls {
  align-items: center;
  background: transparent;
  border-top: 0;
  box-shadow: none;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .7rem;
  justify-content: center;
  max-height: none;
  overflow: visible;
  padding: clamp(.65rem,1.6vw,1rem);
  position: relative;
  z-index: 2;
}

.ktw-product-model-viewer__models,
.ktw-product-model-viewer__finishes {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0;
  max-width: 100%;
  padding: 0;
}

.ktw-product-model-viewer legend {
  color: #073a5a;
  float: left;
  font: 800 .7rem/1.2 Montserrat,Arial,sans-serif;
  padding: 0 .2rem 0 0;
  width: auto;
}

.ktw-product-model-viewer__model,
.ktw-product-model-viewer__reset,
.ktw-product-model-viewer__expand,
.ktw-product-model-viewer__model-select {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(7,58,90,.24);
  border-radius: 999px;
  color: #073a5a;
  cursor: pointer;
  display: inline-flex;
  font: 750 .72rem/1.2 Montserrat,Arial,sans-serif;
  justify-content: center;
  min-height: 40px;
  padding: .6rem .82rem;
}

.ktw-product-model-viewer__expand {
  background: #073a5a;
  border-color: #073a5a;
  color: #fff;
}

.ktw-product-model-viewer__expand::before {
  content: "⛶";
  font-size: 1rem;
  margin-right: .4rem;
}

.ktw-product-model-viewer__model-select {
  appearance: auto;
  min-width: min(72vw,260px);
}

.ktw-product-model-viewer__model[aria-pressed="true"] {
  background: #073a5a;
  border-color: #073a5a;
  color: #fff;
}

.ktw-product-model-viewer__swatch {
  background: var(--ktw-finish,#403a3a);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(7,58,90,.28);
  color: transparent;
  cursor: pointer;
  font-size: 0;
  height: 38px;
  padding: 0;
  position: relative;
  width: 38px;
}

.ktw-product-model-viewer__swatch--announced::after {
  background: #fff;
  border: 1px solid rgba(7,58,90,.2);
  border-radius: 999px;
  bottom: -8px;
  color: #073a5a;
  content: attr(data-availability);
  font: 800 8px/1 Montserrat,Arial,sans-serif;
  left: 50%;
  padding: 2px 3px;
  position: absolute;
  transform: translateX(-50%);
}

.ktw-product-model-viewer__swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 3px #ef7d30;
  transform: scale(.9);
}

.ktw-product-model-viewer__custom-color {
  align-items: center;
  color: #073a5a;
  display: inline-flex;
  font: 750 .7rem/1.2 Montserrat,Arial,sans-serif;
  gap: .4rem;
  padding-left: .2rem;
}

.ktw-product-model-viewer__custom-color input {
  background: transparent;
  border: 0;
  cursor: pointer;
  height: 38px;
  padding: 0;
  width: 38px;
}

.ktw-product-model-viewer__finish-name {
  align-self: center;
  color: #073a5a;
  flex: 1 1 100%;
  font: 700 .66rem/1.35 Montserrat,Arial,sans-serif;
  padding: .28rem .22rem 0;
  text-align: center;
}

.ktw-product-model-viewer__status {
  color: #284e67;
  flex: 1 1 100%;
  font: 650 .68rem/1.45 Montserrat,Arial,sans-serif;
  margin: 0;
  padding: .12rem .35rem 0;
  text-align: center;
}

.ktw-product-model-viewer__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  justify-content: center;
}

.ktw-product-model-viewer button:focus-visible,
.ktw-product-model-viewer input:focus-visible,
.ktw-product-model-dialog button:focus-visible {
  outline: 3px solid #f28a3a;
  outline-offset: 3px;
}

.ktw-product-model-error {
  align-items: center;
  background: #fff7ed;
  border: 1px solid #f4b37f;
  border-radius: 12px;
  bottom: .8rem;
  color: #71360e;
  display: flex;
  flex-wrap: wrap;
  font: 700 .75rem/1.4 Montserrat,Arial,sans-serif;
  gap: .45rem;
  left: 50%;
  margin: 0;
  max-width: calc(100% - 2rem);
  padding: .65rem .85rem;
  position: absolute;
  transform: translateX(-50%);
  z-index: 4;
}

.ktw-product-model-error__retry {
  background: #073a5a;
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font: 800 .7rem/1.2 Montserrat,Arial,sans-serif;
  min-height: 36px;
  padding: .5rem .75rem;
}

html.ktw-product-model-dialog-open,
html.ktw-product-model-dialog-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.ktw-product-model-dialog {
  background: #fff;
  border: 0;
  border-radius: clamp(18px,2.2vw,30px);
  box-shadow: 0 30px 100px rgba(2,20,32,.38);
  color: #073a5a;
  height: min(92dvh,920px);
  margin: auto;
  max-height: none;
  max-width: none;
  overflow: hidden;
  padding: 0;
  width: min(94vw,1440px);
}

.ktw-product-model-dialog::backdrop {
  backdrop-filter: blur(8px);
  background: rgba(2,20,32,.72);
}

.ktw-product-model-dialog__shell {
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  height: 100%;
}

.ktw-product-model-dialog__header {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid rgba(7,58,90,.14);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: 64px;
  padding: .7rem clamp(1rem,3vw,2rem);
}

.ktw-product-model-dialog__header h2 {
  color: #073a5a;
  font: 750 clamp(1rem,2.4vw,1.45rem)/1.2 Montserrat,Arial,sans-serif;
  margin: 0;
}

.ktw-product-model-dialog__close {
  background: #073a5a;
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font: 800 .75rem/1.2 Montserrat,Arial,sans-serif;
  min-height: 42px;
  padding: .65rem 1rem;
}

.ktw-product-model-dialog__close::before {
  content: "×";
  font-size: 1.2rem;
  margin-right: .4rem;
  vertical-align: -.05em;
}

.ktw-product-model-dialog__mount {
  min-height: 0;
  overflow: hidden;
}

.ktw-product-model-dialog__mount > .ktw-product-model-viewer {
  background: #eef5f8;
  border: 0;
  border-radius: 0;
  grid-template-rows: minmax(0,1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.ktw-product-model-dialog .ktw-product-model-viewer__canvas {
  background:
    radial-gradient(circle at 50% 42%,rgba(247,251,253,1),rgba(226,238,244,.98) 66%,rgba(202,220,230,.96));
  border-radius: 0;
  height: 100%;
  min-height: 0;
}

.ktw-product-model-dialog .ktw-product-model-viewer__controls {
  background: #fff;
  border-top: 1px solid rgba(7,58,90,.14);
  box-shadow: 0 -10px 28px rgba(3,34,53,.06);
  display: grid;
  flex-wrap: nowrap;
  gap: .55rem 1rem;
  grid-template-columns: auto minmax(0,1fr) auto;
  overflow: hidden;
  padding: .65rem clamp(.75rem,2vw,1.5rem);
}

.ktw-product-model-dialog .ktw-product-model-viewer__toolbar {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.ktw-product-model-dialog .ktw-product-model-viewer__models {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
}

.ktw-product-model-dialog .ktw-product-model-viewer__finishes {
  flex-wrap: nowrap;
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

.ktw-product-model-dialog .ktw-product-model-viewer__status {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.ktw-product-model-dialog .ktw-product-model-viewer__expand {
  display: none;
}

@media (max-width: 760px) {
  .ktw-product-model-viewer__controls {
    align-items: stretch;
  }

  .ktw-product-model-viewer__models,
  .ktw-product-model-viewer__finishes {
    justify-content: center;
    width: 100%;
  }

  .ktw-product-model-viewer__toolbar { width: 100%; }
  .ktw-product-model-viewer__toolbar > * { flex: 1 1 auto; }

  .ktw-product-model-dialog {
    border-radius: 18px;
    height: 96dvh;
    width: calc(100vw - 16px);
  }

  .ktw-product-model-dialog__header {
    min-height: 58px;
    padding: .55rem .75rem .55rem 1rem;
  }

  .ktw-product-model-dialog__close {
    font-size: 0;
    min-height: 42px;
    min-width: 42px;
    padding: .4rem;
  }

  .ktw-product-model-dialog__close::before {
    font-size: 1.5rem;
    margin: 0;
  }

  .ktw-product-model-dialog .ktw-product-model-viewer__controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    justify-content: center;
    padding: .5rem;
  }

  .ktw-product-model-dialog .ktw-product-model-viewer__models,
  .ktw-product-model-dialog .ktw-product-model-viewer__finishes {
    flex: 1 1 auto;
    width: auto;
  }

  .ktw-product-model-dialog .ktw-product-model-viewer__toolbar {
    flex: 0 0 auto;
    width: auto;
  }

  .ktw-product-model-dialog .ktw-product-model-viewer__reset,
  .ktw-product-model-dialog .ktw-product-model-viewer__model {
    min-height: 36px;
    padding: .45rem .65rem;
  }

  .ktw-product-model-dialog .ktw-product-model-viewer__swatch {
    height: 32px;
    width: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ktw-product-model-viewer,
  .ktw-product-model-viewer__swatch { transition: none !important; }
}
