.taom-v2-gallery {
  position: relative !important;
  isolation: isolate;
}

/* Keep the native photo navigation visible and include the 3D tile in
   WooCommerce's column layout. Extra photos flow onto new rows. */
.taom-v2-gallery .flex-control-thumbs {
  position: relative !important;
  z-index: 35;
  display: grid !important;
  grid-template-columns: repeat(var(--taom-v2-thumbnail-columns, 4), minmax(0, 1fr));
  visibility: visible !important;
  width: 100% !important;
  margin: 10px 0 0 !important;
  padding: 0 !important;
  gap: 8px;
  overflow: visible !important;
  list-style: none;
}

.taom-v2-gallery[data-columns="2"] { --taom-v2-thumbnail-columns: 2; }
.taom-v2-gallery[data-columns="3"] { --taom-v2-thumbnail-columns: 3; }
.taom-v2-gallery[data-columns="5"] { --taom-v2-thumbnail-columns: 5; }
.taom-v2-gallery[data-columns="6"] { --taom-v2-thumbnail-columns: 6; }

.taom-v2-gallery .flex-control-thumbs > li {
  display: block !important;
  float: none !important;
  width: auto !important;
  min-width: 0;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
}

.taom-v2-gallery .flex-control-thumbs img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  visibility: visible !important;
}

/* The editor has no WooCommerce photo navigation. Do not expose the
   frontend thumbnail rail in its live preview. */
.taom-v2-gallery.taom-v2-editor-preview .flex-control-thumbs {
  display: none !important;
}

.taom-v2-gallery.taom-v2-editor-preview .taom-v2-launcher,
.taom-v2-gallery.taom-v2-editor-preview .woocommerce-product-gallery__trigger {
  display: none !important;
}

/* The photo rail is already in the document when the 3D viewer closes.
   Theme entrance animations otherwise make stationary thumbnails appear to
   slide/fade up for no functional reason. */
.taom-v2-gallery .flex-control-thumbs,
.taom-v2-gallery .flex-control-thumbs li,
.taom-v2-gallery .flex-control-thumbs img,
.taom-v2-gallery .flex-control-thumbs button {
  animation: none !important;
  transform: none !important;
  transition: none !important;
}

.taom-v2-gallery.taom-v2-active .flex-viewport,
.taom-v2-gallery.taom-v2-active .woocommerce-product-gallery__wrapper,
.taom-v2-gallery.taom-v2-active .woocommerce-product-gallery__trigger {
  opacity: 0 !important;
  filter: blur(8px);
  pointer-events: none !important;
  transition: opacity 340ms ease, filter 340ms ease;
}

.taom-v2-gallery.taom-v2-active .flex-viewport,
.taom-v2-gallery.taom-v2-active > .woocommerce-product-gallery__wrapper {
  /* A single-photo gallery may have no FlexSlider viewport. Its hidden
     wrapper must leave normal flow too, or it adds a second image height. */
  position: absolute !important;
  z-index: 1;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.taom-v2-gallery.taom-v2-overflow-enabled {
  /* Keep the overlay above nearby product content, below the site header.
     Canvas and photo stacking is local to the isolated gallery. */
  z-index: 1;
}

.taom-v2-gallery.taom-v2-overflow-enabled .taom-v2-viewer {
  /* The transparent overflow canvas must render above the thumbnail rail.
     Its pointer-events:none rule below still lets the rail receive clicks. */
  z-index: 100;
}

.taom-v2-gallery.taom-v2-overflow-enabled .flex-control-thumbs {
  z-index: 80;
  pointer-events: auto;
}

/* Keep page controls clickable through the transparent overflow area. The
   square interaction surface remains active over the authored viewer only. */
.taom-v2-gallery.taom-v2-overflow-enabled .taom-v2-canvas {
  pointer-events: none;
}

.taom-v2-launcher,
.taom-v2-control,
.taom-v2-thumbnail {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.taom-v2-launcher {
  position: absolute;
  z-index: 25;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 15px;
  color: #fff;
  background: rgba(8, 9, 13, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  transition: transform 160ms ease, background 160ms ease;
}

.taom-v2-launcher[hidden] {
  display: none !important;
}

.taom-v2-launcher:hover {
  transform: translateY(-1px);
  background: rgba(8, 9, 13, 0.96);
}

.taom-v2-launcher:focus-visible,
.taom-v2-control:focus-visible,
.taom-v2-thumbnail:focus-visible {
  outline: 3px solid #f2c86b;
  outline-offset: 3px;
}

.taom-v2-gallery.taom-v2-active > .taom-v2-launcher {
  opacity: 0;
  pointer-events: none;
}

.taom-v2-cube {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid rgba(242, 200, 107, 0.75);
  border-radius: 7px;
  color: #f2c86b;
  font-size: 18px;
  line-height: 1;
}

.taom-v2-viewer {
  --taom-v2-bg-color: #07080a;
  --taom-v2-fullscreen-bg-color: #000000;
  --taom-v2-gradient-top: #ffffff;
  --taom-v2-gradient-bottom: #f1f3f7;
  --taom-v2-gradient-angle: 132deg;
  --taom-v2-bg-image: none;
  position: relative;
  z-index: 20;
  width: 100%;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden;
  min-height: 0 !important;
  color: #fff;
  border-radius: inherit;
  background:
    radial-gradient(circle at 68% 18%, rgba(69, 89, 128, 0.48), transparent 34%),
    radial-gradient(circle at 25% 78%, rgba(116, 76, 24, 0.24), transparent 42%),
    linear-gradient(145deg, #12151d 0%, #08090d 55%, #030405 100%);
  contain: layout paint;
  opacity: 0;
  filter: blur(8px);
  transform: translateX(3%);
  transition: opacity 340ms ease, filter 340ms ease, transform 340ms ease;
  user-select: none;
  -webkit-user-select: none;
}

.taom-v2-viewer img,
.taom-v2-viewer canvas {
  -webkit-user-drag: none;
  user-drag: none;
}

/* Experimental preset-controlled overflow. The stage background stays in
   the square root; only the transparent WebGL surface grows beyond it. */
.taom-v2-viewer.taom-v2-overflow-enabled {
  z-index: 60;
  overflow: visible;
  contain: layout;
}

.taom-v2-viewer.taom-v2-overflow-enabled .taom-v2-canvas {
  inset: -35%;
  width: 170%;
  height: 170%;
}

.taom-v2-viewer.taom-v2-visible {
  opacity: 1;
  filter: none;
  transform: translateX(0);
}

.taom-v2-viewer.taom-v2-closing {
  position: absolute;
  z-index: 30;
  top: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
  filter: blur(8px);
  transform: translateX(-3%);
}

.taom-v2-viewer[hidden] {
  display: none !important;
}

/* An explicit preset background is authoritative and must never be masked by
   the single style's visual default or its fullscreen transition. */
.taom-v2-viewer[data-background-mode="solid"] { background: var(--taom-v2-bg-color) !important; }
.taom-v2-viewer[data-background-mode="transparent"] { background: transparent !important; }
.taom-v2-viewer[data-background-mode="gradient"] { background: linear-gradient(var(--taom-v2-gradient-angle), var(--taom-v2-gradient-top), var(--taom-v2-gradient-bottom)) !important; }
.taom-v2-viewer[data-background-mode="gradient"][data-gradient-type="radial"] { background: radial-gradient(circle, var(--taom-v2-gradient-top), var(--taom-v2-gradient-bottom)) !important; }
.taom-v2-viewer[data-background-mode="image"] { background: var(--taom-v2-bg-image) center / cover no-repeat !important; }
.taom-v2-viewer[data-background-fit="fill"][data-background-mode="image"] { background-size: 100% 100% !important; }
.taom-v2-viewer[data-background-fit="fit"][data-background-mode="image"] { background-size: contain !important; }
.taom-v2-viewer[data-background-fit="stretch"][data-background-mode="image"] { background-size: 100% 100% !important; }

.taom-v2-fullscreen-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
  overflow: hidden;
  z-index: 2147483000;
}
.taom-v2-fullscreen-dialog::backdrop { background: #000; }
.taom-v2-fullscreen-placeholder { display: block; width: 100%; pointer-events: none; }

.taom-v2-viewer:is(:fullscreen, .taom-v2-window-fullscreen) {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0;
  aspect-ratio: auto !important;
  border-radius: 0;
  background: var(--taom-v2-fullscreen-bg-color) !important;
}

.taom-v2-viewer.taom-v2-overflow-enabled:is(:fullscreen, .taom-v2-window-fullscreen) {
  overflow: hidden;
  contain: layout paint;
}

.taom-v2-viewer.taom-v2-overflow-enabled:is(:fullscreen, .taom-v2-window-fullscreen) .taom-v2-canvas {
  inset: 0;
  width: 100%;
  height: 100%;
}

.taom-v2-viewer.taom-v2-visible:is(:fullscreen, .taom-v2-window-fullscreen) {
  transform: none;
}

.taom-v2-canvas {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: 0;
  touch-action: none;
}

.taom-v2-interaction-surface {
  position: absolute;
  z-index: 3;
  inset: 0;
  outline: 0;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.taom-v2-interaction-surface:active {
  cursor: grabbing;
}

.taom-v2-scrim {
  display: none;
}

.taom-v2-toolbar {
  position: absolute;
  z-index: 8;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
}

.taom-v2-appearance-variants {
  position: absolute;
  z-index: 9;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 28px);
  overflow-x: auto;
  pointer-events: auto;
}

.taom-v2-appearance-variants[hidden] {
  display: none !important;
}

.taom-v2-appearance-variant {
  display: inline-flex;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  align-items: center;
  justify-content: center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background: #ffffff;
  border: 1px solid #888888;
  border-radius: 0;
  box-shadow: none;
  color: #111111;
  font: 700 16px/1 "acumin-pro-extra-condensed", "Arial Narrow", sans-serif;
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.taom-v2-appearance-variant[aria-pressed="true"] {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

.taom-v2-appearance-variant:hover:not([aria-pressed="true"]) {
  background: #fbaf40;
  border-color: #fbaf40;
}
.taom-v2-appearance-variant:focus-visible { outline: 2px solid currentColor; outline-offset: -4px; }
.taom-v2-viewer .taom-v2-appearance-picker { display: none; }

/* The color names carry the choice; omit decorative dots in the storefront. */
.taom-v2-appearance-swatch {
  display: none;
}

.taom-v2-control {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: #24282e;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(18, 24, 31, 0.12);
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 0;
  line-height: 0;
  transition: transform 160ms ease, background 160ms ease;
}

.taom-v2-control:hover {
  transform: translateY(-1px);
  background: #fff;
}

.taom-v2-fullscreen-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  line-height: 0;
}

.taom-v2-fullscreen-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.taom-v2-fullscreen-icon,
.taom-v2-fullscreen-icon svg,
.taom-v2-fullscreen-icon path {
  color: #24282e !important;
}

.taom-v2-fullscreen-icon path {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8 !important;
}

.taom-v2-reset-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  line-height: 0;
}

.taom-v2-reset-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.taom-v2-loading,
.taom-v2-error {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: 50%;
  display: flex;
  min-width: min(290px, calc(100% - 40px));
  max-width: min(520px, calc(100% - 40px));
  padding: 20px 24px;
  transform: translate(-50%, -50%);
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
  background: rgba(6, 8, 12, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 0;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  text-align: center;
}

.taom-v2-loading[hidden],
.taom-v2-error[hidden] {
  display: none !important;
}

.taom-v2-error {
  flex-direction: column;
}

.taom-v2-loading {
  box-sizing: border-box;
  width: min(180px, calc(100% - 32px));
  min-width: 0;
  aspect-ratio: 1 / 1;
  flex-direction: column;
  padding: 20px;
}

.taom-v2-error-detail {
  font-size: 13px;
  opacity: 0.78;
}

.taom-v2-context-message {
  z-index: 9;
  background: #111419;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.taom-v2-viewer:has(.taom-v2-context-message:not([hidden])) .taom-v2-loading {
  visibility: hidden;
}

.taom-v2-context-message button {
  min-height: 44px;
  padding: 6px 14px;
  color: #111;
  background: #fff;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.taom-v2-has-fallback::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: var(--taom-v2-fallback) center / contain no-repeat;
  content: "";
  opacity: 0.42;
}

.taom-v2-spinner {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #f2c86b;
  border-radius: 50%;
  animation: taom-v2-spin 800ms linear infinite;
}

.taom-v2-progress {
  min-width: 36px;
  color: #f2c86b;
  font-variant-numeric: tabular-nums;
}

.taom-v2-hint {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: 50%;
  padding: 12px;
  transform: translate(-50%, -50%);
  color: #fff;
  background: transparent;
  filter: drop-shadow(0 1px 3px #000);
  pointer-events: none;
}
.taom-v2-hint[hidden] { display: none; }
.taom-v2-drag-icon {
  display: block;
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  animation: taom-v2-drag-hint 2s infinite ease-in-out;
}
@keyframes taom-v2-drag-hint {
  0%, 100% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .taom-v2-drag-icon { animation: none; }
}

.taom-v2-thumbnail {
  box-sizing: border-box;
  display: grid;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 1 / 1;
  place-items: center;
  padding: 0;
  color: #f2c86b;
  background: linear-gradient(145deg, #161a22, #080a0e);
  border: 1px solid rgba(242, 200, 107, 0.36);
  border-radius: 3px;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

@keyframes taom-v2-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 680px) {
  .taom-v2-launcher {
    right: 10px;
    bottom: 10px;
  }

  .taom-v2-control {
    width: 44px;
    height: 44px;
  }

  .taom-v2-toolbar {
    gap: 6px;
  }

  .taom-v2-appearance-variants { overflow: visible; }
  .taom-v2-appearance-variants > .taom-v2-appearance-variant { display: none; }
  .taom-v2-viewer .taom-v2-appearance-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 250px;
    max-width: 100%;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid #888;
    background: #fff;
    color: #111;
    color-scheme: light;
  }
  .taom-v2-viewer .taom-v2-appearance-picker > span { font: 700 13px/1 sans-serif; text-transform: uppercase; }
  .taom-v2-viewer .taom-v2-appearance-select {
    flex: 1;
    min-width: 0;
    width: 100%;
    min-height: 44px;
    height: 44px;
    margin: 0;
    padding: 8px 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    background-image: none;
    color: #111;
    font: 400 16px/1.2 sans-serif;
    text-transform: none;
    box-shadow: none;
    appearance: auto;
    -webkit-appearance: menulist;
  }
  .taom-v2-appearance-picker:focus-within { outline: 2px solid #111; outline-offset: 2px; }
  .taom-v2-viewer:is(:fullscreen, .taom-v2-window-fullscreen) .taom-v2-appearance-picker:focus-within { outline-color: #fbaf40; }
}

@media (prefers-reduced-motion: reduce) {
  .taom-v2-launcher,
  .taom-v2-control,
  .taom-v2-spinner {
    transition: none;
    animation: none;
  }
}

@media (forced-colors: active) {
  .taom-v2-launcher,
  .taom-v2-control,
  .taom-v2-thumbnail,
  .taom-v2-appearance-variant {
    border: 1px solid ButtonText;
  }

  .taom-v2-appearance-variant[aria-pressed="true"] {
    background: Highlight;
    border-color: Highlight;
    color: HighlightText;
  }
}
