/* Product media follows the buyer-page type scale and the storefront's glass surfaces. */
#nail-gallery {
  --ng-ink: var(--nail-ink);
  --ng-muted: var(--nail-muted);
  --ng-red: #922c25;
  --ng-line: var(--nail-edge);
  --ng-shadow: var(--nail-shadow);
  --ng-surface: var(--nail-glass);
  --ng-studio: radial-gradient(ellipse 32% 5% at 50% 91%, #846a5c52, transparent 94%),
    linear-gradient(145deg, #ffffff91, transparent 72%), var(--bg-base);
  --ng-anchor: calc(var(--nail-top, 80px) + var(--ng-nav-height, 52px) + 12px);
  padding-block: 48px;
  color: var(--ng-ink);
  scroll-margin-block-start: var(--ng-anchor);
}

#nail-gallery [hidden] { display: none !important; }
#nail-gallery .ng-heading {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 4px 16px; margin-bottom: 16px;
}
#nail-gallery h2 { margin: 0; font-size: 28px; line-height: 1.25; }
#nail-gallery :is(a, button):focus-visible { outline: 3px solid var(--ng-red); outline-offset: 3px; }
#nail-gallery .ng-video-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px;
  border-radius: 999px; border: 1px solid var(--ng-line); background: var(--nail-clear);
  box-shadow: var(--nail-button-shadow); color: var(--ng-red); text-decoration: none; font-size: 14px; font-weight: 650;
}
#nail-gallery .ng-video-link svg {
  flex: none; width: 14px; height: 14px;
}
#nail-gallery .ng-album {
  --ng-glow: #fffaf3b3;
  --ng-floor: #a48773a8;
  --ng-card: min(52%, 256px);
  --ng-spread: 65%;
  --ng-turn: 12deg;
  --ng-tilt: 24deg;
  position: relative;
  border: 1px solid #cbbab0; border-radius: var(--radius-lg, 26px);
  background: radial-gradient(ellipse at 78% 31%, #fff9edb3, transparent 47%),
    linear-gradient(126deg,#fffaf5ed,#f6eee6a6 40%,#ddccbe82 78%,#fff8eec9),var(--bg-base);
  box-shadow: inset 0 0 0 3px #ffffff5c, var(--ng-shadow);
}
#nail-gallery .ng-album-title {
  position: relative; z-index: 1; margin: 0;
  padding: clamp(17px, 3vw, 32px) clamp(18px, 4vw, 40px) 0;
  color: var(--ng-ink); font-size: clamp(18px, 2vw, 24px); line-height: 1.3;
  overflow-wrap: anywhere;
}
/* Native scrolling keeps every original and its caption accessible without JavaScript. */
#nail-gallery .ng-stage {
  display: flex; gap: 12px; padding: 16px; overflow-x: auto;
  scroll-snap-type: x mandatory; scroll-padding-inline: 16px;
}
#nail-gallery .ng-stage figure {
  flex: 0 0 min(72%, 242px); min-width: 0; margin: 0; padding: 5px;
  scroll-snap-align: center; border: 1px solid #fff; border-radius: 20px;
  background: linear-gradient(140deg, #fffdfa 30%, #f1eae6);
  box-shadow: 0 0 0 1px #907b773b, 0 3px 0 #d9ceca, 0 6px 13px -7px #392b3460;
}
#nail-gallery .ng-stage a {
  display: block; position: relative; overflow: hidden; width: 100%; aspect-ratio: 2 / 3;
  border-radius: 15px; background: #f3ecea; color: var(--ng-ink); cursor: zoom-in;
}
#nail-gallery .ng-stage img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  -webkit-user-drag: none; user-select: none;
}
#nail-gallery .ng-viewer[data-category="machine"] .ng-viewer-image { background: var(--ng-studio); }
#nail-gallery .ng-viewer[data-category="machine"] img { box-sizing: border-box; padding: 6% 8% 5%; }
#nail-gallery .ng-stage figcaption { padding: 8px 5px 4px; color: var(--ng-muted); font-size: 14px; }
#nail-gallery .ng-zoom {
  position: absolute; inset-inline-end: 9px; inset-block-end: 9px; display: grid; place-items: center;
  width: 32px; height: 32px; border: 1px solid #fff9; border-radius: 50%;
  background: var(--nail-clear); color: #45352f; box-shadow: var(--nail-button-shadow);
}
#nail-gallery .ng-zoom svg { width: 15px; height: 15px; }

/* Preserve a full portrait mount. The grid's single in-flow spacer sets the stage
   height independently of any active item's caption or original dimensions. */
#nail-gallery[data-fan-ready] .ng-stage {
  display: grid; grid-template: "cards" / minmax(0,1fr); place-items: center;
  position: relative; isolation: isolate; padding: 30px 0 43px; overflow: visible;
  scroll-snap-type: none; perspective: 980px; perspective-origin: 50% 47%;
  touch-action: pan-y pinch-zoom;
  background: radial-gradient(ellipse 46% 57% at 50% 48%, var(--ng-glow), transparent 98%);
}
#nail-gallery[data-fan-ready] .ng-stage::before {
  content: ""; grid-area: cards; width: var(--ng-card); aspect-ratio: 2 / 3;
}
#nail-gallery[data-fan-ready] .ng-stage::after {
  content: ""; position: absolute; z-index: -1; inset: auto 15% 13px; height: 34px;
  background: radial-gradient(ellipse closest-side,var(--ng-floor),transparent),
    radial-gradient(ellipse closest-side at 50% 76%,#fff9,transparent);
  pointer-events: none;
}
#nail-gallery[data-fan-ready] .ng-stage figure {
  --offset: 0%; --drop: 18px; --depth: -145px; --turn: 0deg; --tilt: 0deg; --scale: .78;
  --card-drag: calc(var(--fan-drag, 0px) * .3);
  grid-area: cards; position: relative; width: var(--ng-card); aspect-ratio: 2/3;
  opacity: 0; z-index: 0; visibility: hidden; pointer-events: none;
  padding: clamp(4px, .55vw, 7px); scroll-snap-align: none;
  transform: translate3d(calc(var(--offset) + var(--card-drag)), var(--drop), var(--depth))
             rotate(var(--turn)) rotateY(var(--tilt)) scale(var(--scale));
  box-shadow: 0 0 0 1px #7d666c50, 0 3px 0 #d1c4c0,
              0 9px 12px -7px #49333f61, 0 25px 26px -19px #48333f73;
}
#nail-gallery[data-fan-ready] .ng-stage figure[data-slot] {
  --drop: 12px; --depth: -72px; --scale: .92;
  z-index: 1; visibility: visible; opacity: 1; pointer-events: auto;
}
#nail-gallery .ng-stage figure[data-slot="-1"] {
  --offset: calc(-1 * var(--ng-spread)); --turn: calc(-1 * var(--ng-turn)); --tilt: var(--ng-tilt);
}
#nail-gallery .ng-stage figure[data-slot="1"] {
  --offset: var(--ng-spread); --turn: var(--ng-turn); --tilt: calc(-1 * var(--ng-tilt));
}
#nail-gallery[data-fan-ready] .ng-stage figure[data-slot="0"] {
  --drop: -3px; --depth: 12px; --scale: 1;
  --card-drag: var(--fan-drag, 0px);
  z-index: 2;
  box-shadow: inset 0 1px 0 white,0 0 0 1px #816d733d,0 3px 0 #e6dace,0 6px 0 -2px #b69f8f,
              0 12px 18px -11px #39281d87,0 28px 34px -18px #5c402e8a;
}
#nail-gallery[data-fan-ready] .ng-stage a { height: 100%; aspect-ratio: auto; }
#nail-gallery .ng-stage [data-slot]:not([data-slot="0"]) a { cursor: pointer; }
#nail-gallery .ng-stage [data-slot]:not([data-slot="0"]) .ng-zoom { opacity: 0; }
#nail-gallery .ng-stage figure::after {
  content: ""; position: absolute; pointer-events: none; inset: 0; border-radius: inherit;
  background: linear-gradient(120deg, #fff4, transparent 32%, transparent 78%, #4e36431f);
  opacity: 0;
}
#nail-gallery .ng-stage [data-slot="-1"]::after,
#nail-gallery .ng-stage [data-slot="1"]::after { opacity: 1; }
#nail-gallery[data-fan-ready] .ng-stage figcaption {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
#nail-gallery .ng-fan-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 78px;
  padding: 16px clamp(20px, 4vw, 40px); border-top: 1px solid #cbbab48a;
  border-end-start-radius: inherit; border-end-end-radius: inherit;
  background: linear-gradient(110deg, #fffdfbc7, #ffffff57); box-shadow: inset 0 1px 0 #fffd;
}
#nail-gallery .ng-current { display: flex; align-items: center; gap: 14px; min-width: 0; }
#nail-gallery [data-fan-count] {
  flex: none; color: #983834; padding-inline-end: 14px; border-inline-end: 1px solid #cababe;
  font: 650 13px/1.4 "Inter",system-ui,sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap;
}
#nail-gallery p[data-fan-caption] { margin: 0; font-size: 16px; line-height: 1.45; font-weight: 600; overflow-wrap: anywhere; color: #352b2d; }
#nail-gallery .ng-fan-controls { flex: none; display: flex; align-items: center; gap: 8px; }
#nail-gallery .ng-fan-controls button {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid #bcaba0; border-radius: 50%; background: var(--nail-clear); box-shadow: var(--nail-button-shadow);
  color: #483a3c; cursor: pointer;
}
#nail-gallery .ng-fan-controls [data-fan-step="1"] {
  background: var(--nail-garnet); border-color: #92392f; box-shadow: var(--nail-garnet-shadow); color: white;
}
#nail-gallery .ng-fan-controls svg { width: 18px; height: 18px; }
html[dir="rtl"] #nail-gallery .ng-fan-controls svg { transform: scaleX(-1); }

#nail-gallery .ng-video {
  width: min(100%, 752px);
  margin: 48px auto 0;
  padding: clamp(16px, 2.4vw, 28px);
  border: 1px solid var(--ng-line);
  border-radius: var(--radius-lg, 26px);
  background: linear-gradient(136deg, #fffcf6bd, #ede1d66b), var(--bg-base);
  box-shadow: var(--ng-shadow);
  scroll-margin-block-start: var(--ng-anchor);
}
#nail-gallery .ng-video h3 { margin: 0 0 18px; color: var(--ng-ink); font-size: 23px; line-height: 1.3; overflow-wrap: anywhere; }
#nail-gallery .ng-films { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
/* The shared player uses .inline-product-video to find the direct YouTube link. */
#nail-gallery .ng-film-card {
  min-width: 0;
  margin: 0;
  padding: 6px;
  background: var(--ng-surface) !important;
  border: 1px solid var(--ng-line) !important;
  border-radius: var(--radius-lg, 26px) !important;
  box-shadow: var(--ng-shadow) !important;
}
#nail-gallery .ng-film-preview, #nail-gallery .ng-film-card video {
  display: block;
  position: relative;
  width: 100%;
  height: auto;
  margin: 0;
  aspect-ratio: 9/16;
  border-radius: var(--radius-md, 18px);
  overflow: hidden;
  background: #231e21;
  object-fit: contain;
}
#nail-gallery .ng-film-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
#nail-gallery .ng-film-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 60px;
  height: 48px;
  margin: auto;
  color: white;
  border: 1px solid #ffffff9c;
  border-radius: 999px;
  background: var(--nail-garnet);
  box-shadow: var(--nail-garnet-shadow),0 7px 20px #20171957;
}
#nail-gallery .ng-film-caption { padding: 14px 12px 12px; }
#nail-gallery .ng-film-caption h4 { margin: 0; color: var(--ng-ink); font-size: 20px; line-height: 1.35; overflow-wrap: anywhere; }
#nail-gallery .ng-film-caption p { margin: 7px 0 0; color: var(--ng-muted); font-size: 16px; line-height: 1.6; }
#nail-gallery .ng-film-caption .inline-video-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: flex-start;
  gap: .4em;
  min-height: 44px;
  padding: 5px 0;
  margin-top: 3px;
  color: var(--ng-red);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#nail-gallery .ng-film-caption .inline-video-link::after { content: '↗'; }

html:has(.ng-viewer[open]) { overflow: hidden; scrollbar-gutter: stable; }
#nail-gallery .ng-viewer {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(calc(40dvh + 48px), 510px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid #ffffffb8;
  border-radius: var(--radius-lg, 26px);
  background: #fffcfaf5;
  color: var(--ng-ink);
  box-shadow: 0 24px 80px #1e17154d, inset 0 1px 0 white;
}
#nail-gallery .ng-viewer:not([open]) { display: none; }
#nail-gallery .ng-viewer::backdrop { background: rgba(36, 30, 34, .52); }
#nail-gallery .ng-viewer-panel { padding: clamp(12px, 2vw, 20px); }
#nail-gallery :is(.ng-viewer-top, .ng-viewer-footer, .ng-arrows) { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#nail-gallery .ng-viewer-top { margin-bottom: 8px; color: var(--ng-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
#nail-gallery .ng-viewer button {
  flex: none; width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
  background: var(--nail-clear); box-shadow: var(--nail-button-shadow); color: var(--ng-ink);
  border: 1px solid var(--ng-line); border-radius: 50%; font: inherit; font-size: 24px; line-height: 1; cursor: pointer;
}
#nail-gallery .ng-viewer-image {
  width: min(100%, 40dvh, 434px); margin-inline: auto; aspect-ratio: 2/3; overflow: hidden;
  border-radius: var(--radius-md, 18px); background: #eeeaeb; touch-action: pan-y pinch-zoom;
}
#nail-gallery .ng-viewer-image img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }
#nail-gallery .ng-viewer-image[aria-busy="true"] img { opacity: 0; }
#nail-gallery .ng-viewer-footer { padding-top: 12px; }
#nail-gallery .ng-viewer-footer p { margin: 0; color: var(--ng-ink); font-size: 15px; line-height: 1.5; }
#nail-gallery .ng-arrows { gap: 6px; }
html[dir="rtl"] #nail-gallery .ng-arrows button span { transform: scaleX(-1); }
body[data-buyer-model="CT-MJ330"] .native-video-dialog:not(.is-mobile-video) {
  padding: 14px;
  border: 1px solid #ffffffa6;
  border-radius: var(--radius-lg, 26px);
  background: #282323f5;
}
body[data-buyer-model="CT-MJ330"] .native-video-dialog:not(.is-mobile-video) iframe { border-radius: var(--radius-md, 18px); }
body[data-buyer-model="CT-MJ330"] .native-video-dialog .buyer-dialog-close { border-radius: 50%; }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #nail-gallery .ng-viewer::backdrop { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
}
@media (hover: hover) and (pointer: fine) {
  #nail-gallery :is(.ng-fan-controls button, .ng-viewer button, .ng-video-link):hover { border-color: #9d766a; }
  #nail-gallery .ng-video-link:hover { text-decoration: underline; text-underline-offset: 3px; }
}
@media (prefers-reduced-motion: no-preference) {
  #nail-gallery[data-fan-ready] .ng-stage figure {
    transition: transform .47s cubic-bezier(.22,.75,.2,1), opacity .24s ease,
                visibility 0s linear .26s;
  }
  #nail-gallery[data-fan-ready] .ng-stage figure[data-slot] { transition-delay: 0s; }
  #nail-gallery[data-fan-ready] .ng-stage[data-dragging] figure { transition-duration: 0s; }
  #nail-gallery .ng-stage figure::after, #nail-gallery .ng-zoom { transition: opacity .32s ease; }
  #nail-gallery :is(.ng-film-play, .ng-fan-controls button, .ng-video-link, .ng-viewer button) {
    transition: transform .18s ease-out, border-color .18s ease-out, background-color .18s ease-out;
  }
  #nail-gallery .ng-viewer[open] { animation: ng-appear .18s ease-out; }
  #nail-gallery .ng-viewer[open]::backdrop { animation: ng-backdrop .18s ease-out; }
  #nail-gallery .ng-viewer-image[data-ready] img { animation: ng-photo .18s ease-out; }
  @media (hover: hover) and (pointer: fine) {
    #nail-gallery .ng-film-preview:hover .ng-film-play { transform: scale(1.06); }
    #nail-gallery :is(.ng-fan-controls button, .ng-viewer button, .ng-video-link):hover { transform: translateY(-2px); }
  }
  #nail-gallery :is(.ng-fan-controls button, .ng-viewer button, .ng-video-link):active { transform: translateY(1px); box-shadow: var(--nail-pressed); }
}
@keyframes ng-appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ng-photo { from { opacity: .72; } to { opacity: 1; } }
@keyframes ng-backdrop { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 860px) {
  #nail-gallery[data-fan-ready] .ng-album {
    display: grid; grid-template-columns: minmax(220px, .9fr) minmax(0, 2fr);
    grid-template-rows: 1fr 1fr; align-items: center; padding-inline: clamp(28px,4vw,48px) 12px;
  }
  #nail-gallery[data-fan-ready] .ng-album-title {
    grid-area: 1 / 1; align-self: end; padding: 12px 0 16px;
    font-size: clamp(24px,2.5vw,32px); text-wrap: balance;
  }
  #nail-gallery[data-fan-ready] .ng-stage { grid-area: 1 / 2 / 3; }
  #nail-gallery[data-fan-ready] .ng-fan-bar {
    grid-area: 2 / 1; align-self: start; flex-direction: column; align-items: start; gap: 20px;
    background: none; border-radius: 0; box-shadow: none; padding: 14px 0 22px;
  }
  #nail-gallery[data-fan-ready] .ng-current { display: grid; align-content: start; gap: 5px; }
  #nail-gallery[data-fan-ready] [data-fan-count] { padding: 0; border: 0; }
}
@media (max-width: 760px) {
  #nail-gallery { padding-block: 32px; }
  #nail-gallery h2 { font-size: 24px; }
  #nail-gallery .ng-video h3 { font-size: 20px; }
  #nail-gallery .ng-heading { gap: 2px 12px; margin-bottom: 10px; }
  #nail-gallery .ng-video-link { font-size: 13px; gap: 5px; padding-inline: 11px; }
  #nail-gallery .ng-album { --ng-card: min(49%, 230px); --ng-spread: 46%; --ng-turn: 10deg; }
  #nail-gallery[data-fan-ready] .ng-stage { padding: 22px 0 36px; }
  #nail-gallery .ng-fan-bar { min-height: 84px; gap: 8px; padding: 12px 14px; }
  #nail-gallery .ng-current { display: grid; gap: 2px; }
  #nail-gallery [data-fan-count] { padding: 0; border: 0; font-size: 12px; }
  #nail-gallery p[data-fan-caption] { font-size: 14px; }
  #nail-gallery .ng-fan-controls { gap: 5px; }
  #nail-gallery .ng-video { margin-block-start: 32px; max-width: 400px; }
  #nail-gallery .ng-films { grid-template-columns: minmax(0, 1fr); }
  #nail-gallery .ng-film-caption h4 { font-size: 18px; }
}
@media (max-height: 540px) {
  #nail-gallery .ng-viewer { width: min(420px, calc(100vw - 24px)); }
  #nail-gallery .ng-viewer-image { width: min(100%, 31dvh); }
}
