/* ==========================================================================
   Puella product relations ("prepojenie produktov")
   Palette lives in custom properties on .puella-relations; override them in
   your own stylesheet rather than editing rules below.
   ========================================================================== */

.puella-relations {
  /* palette */
  --pr-surface: #ffffff;
  --pr-border: #cdcdcd;
  --pr-text: #050406;
  --pr-text-muted: #504f51;
  --pr-accent: #e2097e;
  --pr-accent-border: #f084be;
  --pr-accent-surface: #fce6f2;
  --pr-tooltip-surface: #373638;
  --pr-tooltip-text: #ffffff;

  /* geometry */
  --pr-radius: 8px;
  --pr-gap: 8px;
  --pr-transition: 0.3s;

  margin-bottom: 24px;

  /* Only relevant if .p-info-wrapper is a flex/grid container that assigns `order`
     to its children — ignored otherwise, so it is safe to leave in.
     Check with: getComputedStyle(document.querySelector('.p-info-wrapper')).display
     If it IS flex, set this lower than the price element's order. */
  order: -7;
}

.puella-relations__label {
  margin-bottom: 8px;
  color: var(--pr-text);
  font-size: 13px;
  font-weight: 400;
  line-height: 120%;
}

/* Positioning context for the dropdown panel. Present for every type so the
   markup stays identical across types. */
.puella-relations__control {
  position: relative;
}

.puella-relations__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pr-gap);
}

.puella-relations__option {
  display: flex;
  align-items: center;
  gap: var(--pr-gap);
  padding: 8px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius);
  background: var(--pr-surface);
  cursor: pointer;
  text-decoration: none;
  transition:
    border-color var(--pr-transition),
    background-color var(--pr-transition);
}

.puella-relations__option:hover,
.puella-relations__option:focus-visible {
  border-color: var(--pr-accent-border);
}

/* The current product — rendered as a div, not a link. */
.puella-relations__option--active {
  border-color: var(--pr-accent-border);
  background: var(--pr-accent-surface);
  box-shadow: 0 1px 2px 0 rgba(226, 9, 126, 0.25);
  cursor: default;
}

.puella-relations__option--active .puella-relations__title,
.puella-relations__option--active .puella-relations__subtitle {
  color: var(--pr-accent);
}

.puella-relations__image {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  object-fit: cover;
}

/* primaryText / secondaryText are free-form admin text of unknown length —
   always allow wrapping, or long names overflow the tile. */
.puella-relations__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.puella-relations__title {
  color: var(--pr-text);
  font-size: 15px;
  font-weight: 500;
  line-height: 120%;
  letter-spacing: 1px;
}

.puella-relations__subtitle {
  color: var(--pr-text-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 120%;
  letter-spacing: 1px;
}

/* ==========================================================================
   IMAGE_ONLY — swatches with a CSS hover tooltip
   Swatches carry no visible label. data-tooltip is used instead of the native
   title attribute because title cannot be styled and waits about a second.
   The <img alt> is what assistive tech reads, so this is purely visual.
   ========================================================================== */

.puella-relations--image-only .puella-relations__option[data-tooltip] {
  position: relative;
}

.puella-relations--image-only .puella-relations__option[data-tooltip]::before,
.puella-relations--image-only .puella-relations__option[data-tooltip]::after {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition:
    opacity var(--pr-transition),
    transform var(--pr-transition);
}

/* bubble */
.puella-relations--image-only .puella-relations__option[data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  left: 50%;
  width: max-content;
  max-width: 160px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--pr-tooltip-surface);
  color: var(--pr-tooltip-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 130%;
  text-align: center;
  box-shadow: 0 4px 12px -2px rgba(5, 4, 6, 0.35);
  transform: translate(-50%, 4px);
}

/* Arrow. border-top-color paints the triangle in the TOP half of the 8px box,
   so the box sits at bottom:100% to land the tip flush under the bubble — any
   higher and ::after (a later pseudo-element) paints over it and it vanishes.
   Centred with left/calc because a zero-width box cannot use translateX(-50%). */
.puella-relations--image-only .puella-relations__option[data-tooltip]::before {
  content: '';
  bottom: 100%;
  left: calc(50% - 4px);
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: var(--pr-tooltip-surface);
  transform: translateY(4px);
}

.puella-relations--image-only .puella-relations__option[data-tooltip]:hover::after,
.puella-relations--image-only .puella-relations__option[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.puella-relations--image-only .puella-relations__option[data-tooltip]:hover::before,
.puella-relations--image-only .puella-relations__option[data-tooltip]:focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   IMAGE_WITH_TEXT — tiles sized to their content, wrapping onto more rows
   as needed. Deliberately no fixed items-per-row width and no nowrap: the
   text is admin-authored and either one overflows.
   ========================================================================== */

.puella-relations--image-with-text .puella-relations__option {
  padding: 12px 8px;
  max-width: 100%;
}

.puella-relations--image-with-text .puella-relations__image {
  width: 32px;
  height: 32px;
}

/* ==========================================================================
   DROPDOWN — closed bar showing the current product, panel below
   ========================================================================== */

.puella-relations--dropdown {
  margin-bottom: 16px;
}

.puella-relations--dropdown .puella-relations__preview {
  position: relative; /* positioning context for the chevron below */
  display: flex;
  align-items: center;
  gap: var(--pr-gap);
  min-height: 52px;
  padding: 12px 44px 12px 16px;
  border: 1px solid var(--pr-border);
  border-radius: var(--pr-radius);
  background: var(--pr-surface);
  color: var(--pr-text);
  font-size: 15px;
  font-weight: 400;
  line-height: 120%;
  cursor: pointer;
}

/* Chevron as an inlined SVG data URI — no icon sprite or mask asset needed.
   To recolour it, change the stroke='%23050406' hex inside the URI. */
.puella-relations--dropdown .puella-relations__preview::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 16px;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%23050406' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 50% 50%;
  background-size: contain;
  transition: transform var(--pr-transition);
  pointer-events: none;
}

.puella-relations--dropdown .puella-relations__preview .puella-relations__image {
  width: 32px;
  height: 32px;
}

.puella-relations--dropdown .puella-relations__options {
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  width: 100%;
  padding-top: 2px;
  display: none;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  background: var(--pr-surface);
  border: 1px solid var(--pr-border);
  border-style: none solid solid solid;
  border-bottom-left-radius: var(--pr-radius);
  border-bottom-right-radius: var(--pr-radius);
  z-index: 2;
}

.puella-relations--dropdown .puella-relations__option {
  padding: 10px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.puella-relations--dropdown .puella-relations__option:hover {
  background: var(--pr-accent-surface);
}

.puella-relations--dropdown .puella-relations__option--active {
  background: var(--pr-accent-surface);
  box-shadow: none;
}

.puella-relations--dropdown .puella-relations__image {
  width: 32px;
  height: 32px;
}

.puella-relations--dropdown .puella-relations__title {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: normal;
}

.puella-relations--dropdown.puella-relations--open .puella-relations__preview {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: var(--pr-text);
  box-shadow: 0 4px 10px 0 rgba(5, 4, 6, 0.15);
}

.puella-relations--dropdown.puella-relations--open .puella-relations__preview::after {
  transform: rotate(180deg);
}

.puella-relations--dropdown.puella-relations--open .puella-relations__options {
  display: flex;
  border-color: var(--pr-text);
  box-shadow: 0 6px 10px -4px rgba(5, 4, 6, 0.15);
}
