/**
 * Spa Service Collage: front-end styles.
 *
 * Colours, the name style and the wall height can be changed in the widget's Style
 * and Layout tabs; they arrive here as the --spa-sc-* custom properties.
 *
 * @package SpaServiceCollage
 */

.spa-sc {
  --spa-sc-tile-bg: #e9e1d7;
  --spa-sc-focus: #a4835d;
  --spa-sc-btn-bg: rgba(30, 24, 19, 0.55);
  --spa-sc-action-bg: rgba(255, 255, 255, 0.94);
  --spa-sc-action-color: #2b221c;
  --spa-sc-action-border: transparent;
  --spa-sc-action-bg-hover: #2b221c;
  --spa-sc-action-color-hover: #ffffff;
  --spa-sc-action-border-hover: transparent;
  position: relative;
  width: 100%;
  height: var(--spa-sc-h, 560px);
  overflow: hidden;
  contain: paint;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}
.spa-sc.is-draggable { cursor: grab; }
.spa-sc.is-dragging { cursor: grabbing; }
.spa-sc:focus-visible { box-shadow: inset 0 0 0 2px var(--spa-sc-focus); }
.spa-sc .spa-sc__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-clip-path: inset(0);
  clip-path: inset(0);                   /* a hard edge: the moving 3D boxes are always cut exactly here */
}
.spa-sc .spa-sc__ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}

/*
 * Soft fade at the left and right edges (Layout > Soft fade at the edges). Over a plain
 * background it is two gradients in the background colour (smooth, nothing to redraw);
 * over a photo or gradient background the script switches to a mask (.is-fade-mask).
 */
.spa-sc .spa-sc__fade {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: var(--spa-sc-fade-w, var(--spa-sc-fade, 80px));
  pointer-events: none;
}
.spa-sc .spa-sc__fade.is-left { left: 0; background: linear-gradient(to right, var(--spa-sc-fade-color, #fff), transparent); }
.spa-sc .spa-sc__fade.is-right { right: 0; background: linear-gradient(to left, var(--spa-sc-fade-color, #fff), transparent); }
.spa-sc-fade-yes .spa-sc:not(.is-fade-mask) .spa-sc__fade { display: block; }
.spa-sc-fade-yes .spa-sc.is-fade-mask .spa-sc__stage {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--spa-sc-fade-w, 80px), #000 calc(100% - var(--spa-sc-fade-w, 80px)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--spa-sc-fade-w, 80px), #000 calc(100% - var(--spa-sc-fade-w, 80px)), transparent 100%);
}

.spa-sc .spa-sc__tile {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  margin: 0;
  padding: calc(var(--spa-sc-gap, 10px) / 2);
  transform-origin: 0 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
  pointer-events: none;
}
.spa-sc .spa-sc__card {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: var(--spa-sc-radius, 12px);
  background: var(--spa-sc-tile-bg);
  pointer-events: auto;
  cursor: pointer;
  container: spa-sc-card / inline-size;
}
.spa-sc.is-dragging .spa-sc__card { cursor: grabbing; }

/* loading: a soft shimmer until the photo arrives */
.spa-sc .spa-sc__card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.45) 50%, rgba(255, 255, 255, 0) 70%);
  background-size: 220% 100%;
  animation: spa-sc-shimmer 1.6s ease-in-out infinite;
  transition: opacity 0.4s ease;
}
.spa-sc .spa-sc__card.is-loaded::before { opacity: 0; animation: none; }
@keyframes spa-sc-shimmer {
  from { background-position: 160% 0; }
  to { background-position: -60% 0; }
}

.spa-sc .spa-sc__card img {
  position: absolute;
  display: block;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  object-fit: cover;
  pointer-events: none;
  opacity: 0;
  transform: scale(1);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.spa-sc .spa-sc__card.is-loaded img { opacity: 1; }
.spa-sc .spa-sc__card.is-active img { transform: scale(1.04); }

/* service names: font, size and colours are set in the Style tab (one class, so those win) */
.spa-sc .spa-sc__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-start;
  box-sizing: border-box;
  padding: 2.4em 1em 0.95em;
  font-size: var(--spa-sc-name-size, 15px);
  pointer-events: none;
}
.spa-sc .spa-sc__label.is-bc { justify-content: center; text-align: center; }
.spa-sc .spa-sc__label.is-tl { top: 0; bottom: auto; padding: 0.95em 1em 2.4em; }
.spa-sc__name {
  max-width: 100%;
  overflow: hidden;
  color: #fff;
  font-size: var(--spa-sc-name-size, 15px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spa-sc-names-gradient .spa-sc .spa-sc__label { background: linear-gradient(to top, var(--spa-sc-scrim, rgba(22, 16, 12, 0.66)), transparent); }
.spa-sc-names-gradient .spa-sc .spa-sc__label.is-tl { background: linear-gradient(to bottom, var(--spa-sc-scrim, rgba(22, 16, 12, 0.66)), transparent); }
.spa-sc-names-gradient .spa-sc__name { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.spa-sc-names-shadow .spa-sc__name { text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.spa-sc-names-pill .spa-sc__name {
  padding: 0.45em 0.95em;
  border-radius: 999px;
  background: var(--spa-sc-name-bg, rgba(28, 22, 18, 0.6));
}

/* the two choices: view the photo, or open the service page */
.spa-sc .spa-sc__actions {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  align-content: center;
  gap: 10px;
  padding: 12px;
  box-sizing: border-box;
  background: rgba(22, 16, 12, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.spa-sc .spa-sc__card.is-active .spa-sc__actions {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0s;
}
@media (hover: hover) and (pointer: fine) {
  .spa-sc:not(.is-dragging) .spa-sc__card:hover .spa-sc__actions {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s;
  }
  .spa-sc:not(.is-dragging) .spa-sc__card:hover img { transform: scale(1.04); }
}
/*
 * Buttons set their own colours for every state (normal, hover, focus, pressed) with
 * strong selectors, so a theme's own button colours (for example a pink hover) can't
 * replace them. The colours come from Style > Buttons and boxes.
 */
.spa-sc .spa-sc__card .spa-sc__action {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px 0 15px;
  border: 1px solid var(--spa-sc-action-border);
  border-radius: 999px;
  background: var(--spa-sc-action-bg);
  color: var(--spa-sc-action-color);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(20, 14, 10, 0.18);
  transform: translateY(6px);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.spa-sc .spa-sc__card .spa-sc__action:focus {
  border-color: var(--spa-sc-action-border);
  background: var(--spa-sc-action-bg);
  color: var(--spa-sc-action-color);
  outline: none;
}
.spa-sc .spa-sc__card .spa-sc__action:hover,
.spa-sc .spa-sc__card .spa-sc__action:focus-visible,
.spa-sc .spa-sc__card .spa-sc__action:active {
  border-color: var(--spa-sc-action-border-hover);
  background: var(--spa-sc-action-bg-hover);
  color: var(--spa-sc-action-color-hover);
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(20, 14, 10, 0.28);
}
.spa-sc .spa-sc__card.is-active .spa-sc__action { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .spa-sc .spa-sc__card:hover .spa-sc__action { transform: none; }
  .spa-sc .spa-sc__card .spa-sc__action:hover { transform: translateY(-1px); }
}
.spa-sc .spa-sc__card .spa-sc__action svg { flex: none; width: 18px; height: 18px; }
@container spa-sc-card (max-width: 300px) {
  .spa-sc .spa-sc__card .spa-sc__action { width: 44px; padding: 0; }
  .spa-sc .spa-sc__card .spa-sc__action span { display: none; }
}

/* list of services for screen readers and keyboards; an item shows when it is focused */
.spa-sc .spa-sc__list { margin: 0; padding: 0; list-style: none; }
.spa-sc .spa-sc__list > li > * {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.spa-sc .spa-sc__list > li > *:focus,
.spa-sc .spa-sc__list > li > *:focus:hover {
  top: 14px;
  left: 14px;
  z-index: 6;
  width: auto;
  height: auto;
  margin: 0;
  padding: 10px 16px;
  overflow: visible;
  clip: auto;
  clip-path: none;
  border-radius: 999px;
  background: #fff;
  color: #2b221c;
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(20, 14, 10, 0.2);
  outline: 2px solid var(--spa-sc-focus);
  outline-offset: 2px;
}

/* diagnostics badge (only with ?spa-sc-debug in the page address) */
.spa-sc .spa-sc__debug {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 7;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font: 12px/1.3 monospace;
  pointer-events: none;
}

/* pause / play button */
.spa-sc .spa-sc__toggle {
  all: unset;
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: var(--spa-sc-btn-bg);
  color: #fff;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}
.spa-sc .spa-sc__toggle:hover,
.spa-sc .spa-sc__toggle:focus,
.spa-sc .spa-sc__toggle:active {
  border-color: rgba(255, 255, 255, 0.55);
  background: var(--spa-sc-btn-bg);
  color: #fff;
  opacity: 1;
}
.spa-sc .spa-sc__toggle:focus { outline: none; }
.spa-sc .spa-sc__toggle:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.spa-sc .spa-sc__toggle::before {
  content: "";
  box-sizing: border-box;
  width: 12px;
  height: 14px;
  border-left: 4px solid currentColor;
  border-right: 4px solid currentColor;
}
.spa-sc .spa-sc__toggle.is-paused::before {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent currentColor;
}

/* ---------- photo viewer (added to the page body so headers can't cover it) ---------- */
.spa-sc-viewer {
  --spa-sc-action-bg: rgba(255, 255, 255, 0.94);
  --spa-sc-action-color: #2b221c;
  --spa-sc-action-border: transparent;
  --spa-sc-action-bg-hover: #2b221c;
  --spa-sc-action-color-hover: #ffffff;
  --spa-sc-action-border-hover: transparent;
  position: fixed;
  inset: 0;
  z-index: 999999;
  visibility: hidden;
  pointer-events: none;
  font-family: inherit;
}
.spa-sc-viewer.is-open { visibility: visible; pointer-events: auto; }
.spa-sc-viewer .spa-sc-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 18, 14, 0.9);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.spa-sc-viewer.is-shown .spa-sc-viewer__backdrop { opacity: 1; }
.spa-sc-viewer .spa-sc-viewer__frame {
  position: fixed;
  overflow: hidden;
  border-radius: 14px;
  background: #3a3029;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  touch-action: pan-y;
  transition-property: top, left, width, height, border-radius, opacity;
  transition-duration: 0.45s;
  transition-timing-function: cubic-bezier(0.2, 0.75, 0.2, 1);
}
.spa-sc-viewer .spa-sc-viewer__frame.no-anim { transition: none; }
.spa-sc-viewer .spa-sc-viewer__frame img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border: 0;
  object-fit: cover;
  -webkit-user-select: none;
  user-select: none;
  transition: opacity 0.16s ease;
}
.spa-sc-viewer .spa-sc-viewer__frame img.is-switching { opacity: 0; }
.spa-sc-viewer .spa-sc-viewer__bar {
  position: fixed;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.spa-sc-viewer.is-shown .spa-sc-viewer__bar { opacity: 1; transition-delay: 0.2s; }
.spa-sc-viewer .spa-sc-viewer__name {
  flex: 1 1 200px;
  margin: 0;
  color: #fff;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.spa-sc-viewer .spa-sc-viewer__bar .spa-sc-viewer__visit,
.spa-sc-viewer .spa-sc-viewer__bar .spa-sc-viewer__visit:focus {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px 0 22px;
  box-sizing: border-box;
  border: 1px solid var(--spa-sc-action-border);
  border-radius: 999px;
  background: var(--spa-sc-action-bg);
  color: var(--spa-sc-action-color);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  outline: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.spa-sc-viewer .spa-sc-viewer__bar .spa-sc-viewer__visit:hover,
.spa-sc-viewer .spa-sc-viewer__bar .spa-sc-viewer__visit:focus-visible,
.spa-sc-viewer .spa-sc-viewer__bar .spa-sc-viewer__visit:active {
  border-color: var(--spa-sc-action-border-hover);
  background: var(--spa-sc-action-bg-hover);
  color: var(--spa-sc-action-color-hover);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}
.spa-sc-viewer .spa-sc-viewer__bar .spa-sc-viewer__visit svg { width: 18px; height: 18px; }
.spa-sc-viewer .spa-sc-viewer__count {
  position: fixed;
  top: 22px;
  left: 24px;
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.spa-sc-viewer .spa-sc-viewer__btn {
  all: unset;
  position: fixed;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease, background-color 0.2s ease;
}
.spa-sc-viewer .spa-sc-viewer__btn svg { width: 22px; height: 22px; }
.spa-sc-viewer.is-open .spa-sc-viewer__btn:focus {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
}
.spa-sc-viewer.is-open .spa-sc-viewer__btn:hover,
.spa-sc-viewer.is-open .spa-sc-viewer__btn:focus-visible,
.spa-sc-viewer.is-open .spa-sc-viewer__btn:active {
  border-color: var(--spa-sc-action-bg);
  background: var(--spa-sc-action-bg);
  color: var(--spa-sc-action-color);
}
.spa-sc-viewer.is-open .spa-sc-viewer__btn:focus-visible,
.spa-sc-viewer .spa-sc-viewer__bar .spa-sc-viewer__visit:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.spa-sc-viewer .spa-sc-viewer__close { top: 12px; right: 16px; }
.spa-sc-viewer .spa-sc-viewer__prev { top: 50%; left: 20px; margin-top: -24px; }
.spa-sc-viewer .spa-sc-viewer__next { top: 50%; right: 20px; margin-top: -24px; }
.spa-sc-viewer.is-shown .spa-sc-viewer__btn,
.spa-sc-viewer.is-shown .spa-sc-viewer__count { opacity: 1; transition-delay: 0.15s; }

@media (max-width: 639px) {
  .spa-sc-viewer .spa-sc-viewer__prev,
  .spa-sc-viewer .spa-sc-viewer__next { top: auto; bottom: 20px; margin-top: 0; }
  .spa-sc-viewer .spa-sc-viewer__name { font-size: 17px; }
  .spa-sc-viewer .spa-sc-viewer__bar { justify-content: center; text-align: center; padding: 0 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .spa-sc .spa-sc__card::before { animation: none; }
  .spa-sc .spa-sc__card img,
  .spa-sc .spa-sc__card .spa-sc__action,
  .spa-sc-viewer .spa-sc-viewer__frame,
  .spa-sc-viewer .spa-sc-viewer__backdrop { transition-duration: 0.01s; }
}
