/* Reusable pieces: buttons, eyebrow, icons, the 3D stage (skeleton, fallback,
   watermark, caption, controls) and the feature strip. */

/* Buttons */
.button {
  padding: 13px 19px;
  border-radius: 5px;
  font-size: 11px;
  min-height: 44px;
}

.button-orange {
  background: #ee843b;
  color: var(--ink);
}

.button-orange span {
  margin-left: 20px;
}

.button-outline {
  border: 1px solid #59674f;
  color: #e0e7d5;
}

/* Eyebrow */
.eyebrow {
  font:
    600 10px/1.6 Arial,
    sans-serif;
  letter-spacing: 2px;
  margin-bottom: 13px;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  margin-right: 8px;
  vertical-align: 2px;
}

/* Icons — SVG geometry keeps decorative icons independent of device emoji fonts. */
.ui-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

/* Symbol library for <use>; never painted itself. */
.icon-sprite {
  display: none;
}

/* Stage */
.stage-wrap {
  position: relative;
  border: 1px solid var(--line-stage);
  border-radius: 12px;
  overflow: hidden;
  background: radial-gradient(ellipse at 55% 35%, #fafbf5 10%, #edf0e5 65%, #e8eddf 100%);
}

.stage-top {
  position: absolute;
  top: 22px;
  left: 25px;
  right: 25px;
  display: flex;
  justify-content: space-between;
  z-index: 2;
  pointer-events: none;
  font:
    500 9px/1.2 Arial,
    sans-serif;
  letter-spacing: 1.7px;
  color: var(--moss);
}

.tiny-cross {
  color: #6e7c60;
  font-size: 14px;
  margin-right: 8px;
}

.tiny-cross .ui-icon {
  vertical-align: 0;
}

.shop-viewer {
  position: relative;
  width: 100%;
  height: clamp(400px, 48vw, 600px);
  overflow: hidden;
}

/* touch-action is the initial value only: shop-viewer.js sets it per pointer type. */
.shop-viewer canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  cursor: grab;
  touch-action: pan-y;
}

.shop-viewer canvas:active {
  cursor: grabbing;
}

.shop-viewer canvas:focus-visible {
  outline: 3px solid #b44f16;
  outline-offset: -5px;
}

.viewer-fallback {
  position: absolute;
  inset: 50px 6% 5%;
  width: 88%;
  height: 85%;
  object-fit: cover;
  object-position: center 35%;
  border-radius: 6px;
  z-index: 1;
}

.shop-viewer[data-state='ready'] .viewer-fallback {
  display: none;
}

.stage-watermark {
  white-space: nowrap;
  position: absolute;
  top: 11%;
  left: 50%;
  transform: translateX(-50%);
  font:
    900 clamp(100px, 21vw, 290px) / 1 Arial,
    sans-serif;
  letter-spacing: -0.075em;
  color: rgb(171 184 155 / 12%);
  pointer-events: none;
}

/* Loading skeleton — reserves the model area while modules and artwork load;
   photos are fallback only. */
.viewer-skeleton {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  padding: 50px 24px;
  pointer-events: none;
}

.viewer-loading-enabled .shop-viewer[data-state='loading'] .viewer-skeleton {
  display: flex;
}

.viewer-loading-enabled .shop-viewer[data-state='loading'] .viewer-fallback,
.shop-viewer[data-state='loading'] canvas {
  visibility: hidden;
}

.viewer-skeleton p {
  font-size: 13px;
  color: var(--moss);
}

.skeleton-shop {
  width: min(80%, 440px);
  height: 110px;
  border-top: 28px solid var(--skeleton);
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #e4e9dc;
  border-radius: 6px;
  animation: shop-loading 1.6s ease-in-out infinite alternate;
}

.skeleton-shop span {
  flex: 1;
  background: var(--skeleton);
  border-radius: 3px;
}

@keyframes shop-loading {
  from {
    opacity: 0.45;
  }

  to {
    opacity: 1;
  }
}

/* Stage caption and controls */
.stage-bottom {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 0 25px 20px;
}

.viewer-caption {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
}

.viewer-caption small {
  display: block;
  font-size: 9px;
  color: var(--moss);
  margin-top: 2px;
}

.orbit-mark {
  font: 28px Arial;
  border: 1px solid #bfc8b5;
  border-radius: 50%;
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  color: #67765b;
}

.viewer-controls {
  display: flex;
  gap: 3px;
  align-items: center;
  padding: 5px;
  background: #fffdf8;
  border: 1px solid #dde1d5;
  border-radius: 9px;
  box-shadow: 0 4px 12px #263c1410;
}

.viewer-controls button {
  min-width: 37px;
  min-height: 36px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 21px;
}

.viewer-controls button:first-child {
  font-size: 11px;
  padding: 0 12px;
}

.viewer-controls button:hover {
  background: #eef0e8;
}

.control-divider {
  height: 20px;
  border-left: 1px solid var(--line);
  margin: 0 4px;
}

/* Feature strip */
.feature-strip {
  background: var(--ink);
  color: #e9ecdf;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 18px;
  padding: 24px 5%;
  font-size: 13px;
}

/* Above 600px the wrapper is transparent: label and star sit directly in the strip. */
.feature-item {
  display: contents;
}

.strip-star {
  font-size: 22px;
  color: var(--orange);
}

.feature-strip .mobile-only-star {
  display: none;
}

@media (min-width: 1500px) {
  .shop-viewer {
    height: 620px;
  }
}

@media (max-width: 900px) {
  .button {
    font-size: 14px;
  }

  .shop-viewer {
    height: 480px;
  }

  .stage-bottom {
    flex-wrap: wrap;
  }

  .viewer-caption {
    font-size: 12px;
    line-height: 1.6;
  }

  .viewer-caption small {
    font-size: 11px;
  }

  .orbit-mark {
    flex-shrink: 0;
  }

  .viewer-controls {
    margin-left: auto;
  }

  .viewer-controls button {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 600px) {
  .button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
  }

  .eyebrow {
    font-size: 9px;
    letter-spacing: 1.6px;
  }

  .stage-top {
    left: 15px;
    right: 15px;
    top: 17px;
    font-size: 7px;
    letter-spacing: 1px;
  }

  .shop-viewer {
    height: clamp(280px, 80vw, 340px);
  }

  .stage-watermark {
    top: 25%;
    font-size: 105px;
  }

  /* Instructions, controls and the scroll hint each get their own row. */
  .stage-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 6px 16px 18px;
  }

  .viewer-caption {
    width: auto;
    justify-content: center;
    align-items: center;
    gap: 10px;
  }

  .viewer-caption > div {
    min-width: 0;
  }

  .viewer-caption #viewer-status {
    display: block;
    font-size: 12px;
    line-height: 1.5;
  }

  .viewer-caption small {
    font-size: 12px;
  }

  .stage-wrap:not(:has(.shop-viewer[data-state='ready'])) .viewer-description {
    display: block;
  }

  .stage-wrap:has(.shop-viewer[data-state='ready']) .viewer-caption .viewer-description {
    display: none;
  }

  .stage-wrap:has(.shop-viewer[data-state='ready']) .stage-bottom::after {
    content: 'เลื่อนหน้าจากนอกกรอบโมเดล';
    display: block;
    text-align: center;
    font-size: 11px;
    line-height: 1.6;
    color: var(--moss);
    padding-top: 10px;
    border-top: 1px solid #d5ddcc;
  }

  .orbit-mark {
    width: 28px;
    height: 28px;
    font-size: 21px;
  }

  .viewer-controls {
    margin: 0;
    justify-content: center;
    gap: 8px;
    box-shadow: none;
  }

  .viewer-controls button:first-child {
    padding: 0 7px;
    font-size: 12px;
  }

  .feature-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex-wrap: wrap;
    gap: 0;
    padding: 12px 5%;
    font-size: 13px;
  }

  .feature-strip .feature-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 8px;
    line-height: 1.7;
    min-width: 0;
  }

  .feature-strip > .feature-item:nth-of-type(-n + 2) {
    border-bottom: 1px solid var(--strip-divider);
  }

  .feature-strip > .feature-item:nth-of-type(odd) {
    border-right: 1px solid var(--strip-divider);
  }

  .strip-star {
    font-size: 15px;
  }

  .feature-strip .strip-star {
    display: block;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    order: -1;
  }

  /* Must follow .feature-strip .strip-star: same specificity, and the fourth star
     is hidden at every wider width by the base rule above. */
  .feature-strip .mobile-only-star {
    display: block;
  }
}

@media (max-width: 374px) {
  .feature-strip {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-shop {
    animation: none;
  }
}
