.olafa-gallery-hero {
  padding-top: clamp(1.25rem, 3vw, 2rem);
  padding-bottom: clamp(0.75rem, 2vw, 1.25rem);
  text-align: left;
}

.olafa-gallery-hero .olafa-container {
  text-align: left;
}

.olafa-gallery-hero .olafa-meta {
  margin: 0 0 10px;
}

.olafa-gallery-hero .olafa-title {
  margin: 0 0 1rem;
}

.olafa-gallery-hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.65rem;
}

.olafa-gallery-actions {
  margin: 0 0 1rem;
}

.olafa-gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

/* Как .olafa-product на главной: только прямые углы, без нативного стиля <button> */
.olafa-gallery-grid .olafa-gallery-card,
.olafa-gallery-grid .olafa-gallery-card__media,
.olafa-gallery-grid .olafa-gallery-card__media picture,
.olafa-gallery-grid .olafa-gallery-card__media img {
  border-radius: 0;
}

.olafa-gallery-card {
  display: grid;
  grid-template-rows: auto auto;
  width: 100%;
  margin: 0;
  padding: 0 0 14px;
  border: 0;
  border-radius: 0;
  background: var(--olafa-bg, #fff);
  overflow: hidden;
  box-shadow: none;
  text-align: center;
  cursor: pointer;
  transition: color 0.25s var(--olafa-ease, ease);
}

.olafa-gallery-card:focus {
  outline: none;
}

.olafa-gallery-card:hover .olafa-gallery-card__title,
.olafa-gallery-card:focus-visible .olafa-gallery-card__title {
  color: color-mix(in srgb, var(--olafa-accent, #3d2dbf) 78%, var(--olafa-text-secondary, #5f5f5f));
}

.olafa-gallery-card:hover,
.olafa-gallery-card:focus-visible {
  transform: none;
  box-shadow: none;
}

.olafa-gallery-card:focus-visible {
  outline: 2px solid var(--olafa-accent, #3d2dbf);
  outline-offset: 2px;
}

.olafa-gallery-card__media {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 0;
  background: var(--olafa-bg-muted, #f8f7ff);
}

.olafa-gallery-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: 0;
  display: block;
}

.olafa-gallery-card__body {
  display: block;
  padding: 14px 16px 0;
}

.olafa-gallery-card__title {
  margin: 0 0 8px;
  font-size: clamp(13px, 1.45vw, 15px);
  line-height: 1.35;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--olafa-text-secondary, #5f5f5f);
}

.olafa-gallery-card__price {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(
    in srgb,
    var(--olafa-text-primary, #111111) 52%,
    var(--olafa-text-secondary, #5f5f5f)
  );
}

.olafa-gallery-card__cta {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  min-height: 1.5rem;
  color: color-mix(
    in srgb,
    var(--olafa-accent, #3d2dbf) 62%,
    var(--olafa-text-secondary, #5f5f5f)
  );
  transition: color 0.22s var(--olafa-ease, ease);
}

.olafa-gallery-card__view-icon {
  display: block;
  flex-shrink: 0;
}

.olafa-gallery-card:hover .olafa-gallery-card__cta,
.olafa-gallery-card:focus-visible .olafa-gallery-card__cta {
  color: color-mix(in srgb, var(--olafa-accent, #3d2dbf) 82%, var(--olafa-text-secondary, #5f5f5f));
}

.olafa-gallery-grid-sentinel {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 3rem;
  margin-top: 1rem;
}

.olafa-gallery-grid-sentinel[hidden] {
  display: none;
}

.olafa-gallery-grid-sentinel__label {
  font-size: 0.875rem;
  color: var(--olafa-muted, #6b6560);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.olafa-gallery-grid-sentinel.is-loading .olafa-gallery-grid-sentinel__label {
  opacity: 1;
}

.olafa-gallery-error {
  margin: 0;
  color: #8b2942;
}

.olafa-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.olafa-gallery-modal.is-dismissed {
  display: none;
}

.olafa-gallery-modal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(16, 14, 28, 0.58);
  backdrop-filter: blur(3px);
}

.olafa-gallery-modal__panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100dvh - 1rem);
  background: var(--olafa-bg, #fff);
  border: 1px solid var(--olafa-border, rgba(61, 45, 191, 0.14));
  border-radius: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
  box-shadow: 0 20px 48px rgba(27, 19, 87, 0.18);
}

.olafa-gallery-modal__close,
.olafa-gallery-modal__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--olafa-border, rgba(61, 45, 191, 0.18));
  background: color-mix(in srgb, var(--olafa-bg, #fff) 92%, transparent);
  color: var(--olafa-text-primary, #1a1628);
  cursor: pointer;
  transition:
    border-color 0.22s var(--olafa-ease, ease),
    color 0.22s var(--olafa-ease, ease),
    background 0.22s var(--olafa-ease, ease),
    box-shadow 0.22s var(--olafa-ease, ease);
  backdrop-filter: blur(8px);
}

.olafa-gallery-modal__close:hover,
.olafa-gallery-modal__close:focus-visible,
.olafa-gallery-modal__nav:hover,
.olafa-gallery-modal__nav:focus-visible {
  border-color: var(--olafa-accent, #3d2dbf);
  color: var(--olafa-accent, #3d2dbf);
  box-shadow: 0 8px 22px rgba(61, 45, 191, 0.14);
}

.olafa-gallery-modal__close:focus-visible,
.olafa-gallery-modal__nav:focus-visible {
  outline: 2px solid var(--olafa-accent, #3d2dbf);
  outline-offset: 2px;
}

.olafa-gallery-modal__icon {
  display: block;
  flex-shrink: 0;
}

.olafa-gallery-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 0;
}

.olafa-gallery-modal__media {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  background: var(--olafa-bg-muted, #f5f4fc);
}

.olafa-gallery-modal__media.is-horiz-swipe {
  touch-action: none;
}

.olafa-gallery-modal__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: min(68vh, 640px);
  padding: 1.25rem 3.5rem;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.olafa-gallery-modal__stage.is-horiz-swipe {
  touch-action: none;
}

.olafa-gallery-modal__stage picture {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.olafa-gallery-modal__stage img {
  width: auto;
  max-width: 100%;
  max-height: min(62vh, 560px);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 0;
  display: block;
  touch-action: pan-y;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.olafa-gallery-modal__stage picture.is-swipe-shift {
  transition: transform 0.2s var(--olafa-ease, ease);
}

.olafa-gallery-modal__stage picture.is-swipe-shift.is-swiping {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .olafa-gallery-modal__stage img {
    transition: none;
  }
}

.olafa-gallery-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 0;
}

.olafa-gallery-modal__nav--prev {
  left: 0.65rem;
}

.olafa-gallery-modal__nav--next {
  right: 0.65rem;
}

.olafa-gallery-modal__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 0.75rem 1rem;
  align-items: end;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid var(--olafa-border, rgba(61, 45, 191, 0.14));
}

.olafa-gallery-modal__meta {
  min-width: 0;
}

.olafa-gallery-modal__info {
  min-width: 0;
  display: grid;
  gap: 0.65rem;
  justify-items: start;
}

.olafa-gallery-modal__counter {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: var(--olafa-text-secondary, #5f5a75);
}

.olafa-gallery-modal__price {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.olafa-gallery-modal__title {
  margin: 0;
  font-size: clamp(1rem, 2.6vw, 1.28rem);
  line-height: 1.35;
  font-weight: 600;
}

.olafa-gallery-modal__buy {
  width: 100%;
  max-width: 220px;
}

html[data-theme="dark"] .olafa-gallery-modal__panel {
  background: var(--olafa-bg, #1a1628);
  border-color: rgba(155, 142, 239, 0.22);
}

html[data-theme="dark"] .olafa-gallery-modal__close,
html[data-theme="dark"] .olafa-gallery-modal__nav {
  background: color-mix(in srgb, var(--olafa-bg, #1a1628) 88%, #fff 12%);
  border-color: rgba(155, 142, 239, 0.28);
  color: var(--olafa-text-primary, #f4f2ff);
}

html[data-theme="dark"] .olafa-gallery-modal__media {
  background: color-mix(in srgb, var(--olafa-bg-muted, #252038) 90%, #000 10%);
}

@media (min-width: 560px) {
  .olafa-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 559px) {
  .olafa-gallery-modal {
    padding: 0;
    align-items: stretch;
  }

  .olafa-gallery-modal__panel {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  .olafa-gallery-modal__media {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
  }

  .olafa-gallery-modal__stage {
    flex: 1;
    min-height: 0;
    height: 100%;
    padding: 1rem 2.85rem;
  }

  .olafa-gallery-modal__stage picture {
    height: 100%;
    max-height: 100%;
  }

  .olafa-gallery-modal__stage img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
  }

  .olafa-gallery-modal__body {
    flex: 0 0 auto;
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .olafa-gallery-modal__nav {
    width: 36px;
    height: 36px;
  }

  .olafa-gallery-modal__nav--prev {
    left: 0.4rem;
  }

  .olafa-gallery-modal__nav--next {
    right: 0.4rem;
  }

  .olafa-gallery-modal__buy {
    max-width: none;
  }
}

@media (min-width: 960px) {
  .olafa-gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.1rem;
  }

  .olafa-gallery-modal__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 1.25rem 1.15rem;
    gap: 0.5rem;
  }

  .olafa-gallery-modal__meta,
  .olafa-gallery-modal__info {
    width: 100%;
    max-width: 36rem;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .olafa-gallery-modal__info {
    gap: 0.75rem;
  }

  .olafa-gallery-modal__counter,
  .olafa-gallery-modal__price,
  .olafa-gallery-modal__title {
    width: 100%;
    text-align: center;
  }

  .olafa-gallery-modal__buy {
    width: auto;
    min-width: 12rem;
    max-width: none;
    margin-inline: auto;
  }
}
