/* 3D Textures: its own color-2 strip with scalloped top and bottom edges, holding the 3D viewer */

.textures-section { --scallop: var(--color-2); background: var(--color-2); }
.textures-section .showcase-placeholder { margin: 0; }

/* 3D viewer: a paper stage showing one model (model-viewer: drag or swipe to spin, pinch to zoom on touch)
   or its flat painted texture (opens the lightbox), with name chips below to pick the model (script.js) */
.model-viewer { --band: var(--paper); max-width: 920px; margin: 0 auto; }
.model-stage {
  position: relative;
  height: 380px;
  border: var(--line);
  border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 45%, var(--paper) 30%, var(--background) 78%);
  box-shadow: var(--shadow);
}
.model-3d {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  --poster-color: transparent;
  --progress-bar-color: var(--accent);
  --progress-bar-height: 4px;
}
.model-texture { position: absolute; inset: 64px 14px 42px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; background: none; cursor: zoom-in; }
.model-texture img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transform: rotate(-1.5deg);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
  animation: pop .35s cubic-bezier(.34, 1.3, .64, 1);
}
.model-texture:focus-visible img { transform: rotate(0) scale(1.02); }
.model-note { position: absolute; inset: 0; display: grid; place-content: center; margin: 0; padding: 30px; font-weight: 800; text-align: center; }

.model-toggle.button { position: absolute; top: 10px; right: 10px; z-index: 2; gap: 8px; min-height: 40px; padding: 0 14px; font-size: .92rem; }
.model-toggle svg { width: 18px; }
.model-hint { position: absolute; left: 14px; bottom: 8px; margin: 0; font-family: var(--font-hand); font-size: 1.3rem; color: var(--accent-deep); transform: rotate(-4deg); pointer-events: none; }

.model-star { position: absolute; z-index: 2; pointer-events: none; }
.model-star-1 { top: -24px; left: -14px; width: 48px; animation: bob 4.2s ease-in-out infinite; }
.model-star-2 { right: 18%; bottom: -18px; width: 32px; animation: twinkle 2.4s ease-in-out infinite; }

/* The chips sit in one line that slides (script.js) so the picked one is always in the middle; the ends
   fade out to hint at more. overflow: clip, not hidden, so focusing a chip can't scroll the line. On touch
   screens a sideways swipe on the line picks the next or previous model (script.js) */
.model-picker {
  margin-top: 18px;
  padding: 12px 0 14px;
  overflow: hidden;
  overflow: clip;
  touch-action: pan-y;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
.model-track { position: relative; display: flex; gap: 8px; width: max-content; }
.model-picker.is-ready .model-track { transition: transform .5s cubic-bezier(.34, 1.3, .64, 1); }
.model-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 8px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 99px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.model-chip[aria-pressed="true"] { background: var(--color-1); transform: rotate(-3deg); }

/* Hover effects only where there's a mouse: on phones a tap would leave them stuck on */
@media (hover: hover) {
  .model-texture:hover img { transform: rotate(0) scale(1.02); }
  .model-chip:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
  /* The picked chip keeps its tilt */
  .model-chip[aria-pressed="true"]:hover { transform: rotate(-3deg); }
}

@media (min-width: 681px) {
  .model-stage { height: clamp(360px, 50vw, 520px); }
  .model-texture { inset: 22px 22px 46px; }
  .model-toggle.button { top: 14px; right: 14px; min-height: 44px; padding: 0 18px; font-size: 1rem; }
  .model-toggle svg { width: 22px; }
  .model-hint { left: 20px; font-size: 1.5rem; }
  .model-star-1 { top: -34px; left: -36px; width: 72px; }
  .model-star-2 { bottom: -26px; width: 46px; }
  .model-picker { margin-top: 22px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent); mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent); }
  .model-track { gap: 12px; }
  .model-chip { padding: 6px 16px; font-size: .95rem; }
}
