/**
 *
 * Styles scoped to specific WordPress blocks
 *
 *
 **/

/*
  * Buttons block	
  */

:is(.wp-element-button, .wp-block-button__link) {
  border-radius: 0.35em;
  line-height: 1.35;
  position: relative;
}

/* "Post comment" button */
.form-submit input[type="submit"] {
  font-family: "Overpass Mono", ui-monospace;
  text-transform: uppercase;
  font-weight: 600;
  background-color: var(--wp--preset--color--blue-200);
  color: var(--wp--preset--color--blue-900);
}

:is(
    .wp-element-button,
    .wp-block-button__link,
    .form-submit input[type="submit"]
  ):hover:before {
  border-radius: 0.35em;
  content: "";
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: rgba(255, 255, 255, 0.1);
  mix-blend-mode: overlay;
}

:is(
    .wp-element-button,
    .wp-block-button__link,
    .form-submit input[type="submit"]
  ):active:before {
  background-color: rgba(0, 0, 0, 0.2);
}

/*
 * Post excerpt
 */

.wp-block-post-excerpt {
  margin: 0;
}

/*
 * Post terms 
 */

.wp-block-post-terms a {
  text-decoration: none;
  font-family: "Overpass Mono", ui-monospace;
  color: white !important;
  background-color: var(--wp--preset--color--red-600) !important;
  text-transform: uppercase;
  font-size: var(--wp--preset--font-size--sm);
  line-height: 1.4;
  padding: 0.3em 0.5em;
  font-style: normal;
  font-weight: 700;
  display: inline-block;
  margin-right: 0.5em;
  margin-bottom: 0.3em;
  padding-top: var(--wp--preset--spacing--xs);
  padding-bottom: var(--wp--preset--spacing--xs);
  padding-left: var(--wp--preset--spacing--xs);
  padding-right: var(--wp--preset--spacing--xs);
}

.wp-block-post-terms .wp-block-post-terms__separator {
  display: none;
}

/*
 * Latest posts
 */

.wp-block-latest-posts__list li {
  margin-bottom: 1rem;
}

/*
 * Query loop
 */

.wp-block-query {
  margin-top: 0;
}

/* 
 * Post author
 */

.wp-block-post-author p {
  font-size: 1em;
  display: inline;
}

.wp-block-post-author p:first-of-type:after {
  content: " ";
}

/*
 * CUSTOM Wrapper block
 */

.wp-block-custom-wrapper {
  position: relative;
  max-width: var(--wp--style--global--wide-size);
  margin-left: auto;
  margin-right: auto;
}

.wp-block-custom-wrapper,
.wp-block-custom-wrapper *,
.wp-block-custom-wrapper *:before,
.wp-block-custom-wrapper *:after {
  box-sizing: border-box;
}

.wp-block-custom-wrapper .inner {
  width: 100%;
  height: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.wp-block-custom-wrapper.width-normal .inner {
  max-width: var(--wp--style--global--content-size);
}

/*
 * CUSTOM Carousel block
 */

.wp-block-custom-carousel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wp-block-custom-carousel-slide {
  width: 100%;
  box-sizing: border-box;
}

/* Once JS initializes, use a positioned viewport for sliding */

.carousel-viewport {
  position: relative;
  overflow: hidden;
  flex: 1 1 auto;
}

.carousel-viewport > .wp-block-custom-carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translateX(100%);
  visibility: hidden;
}

.carousel-viewport > .carousel-slide-active {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.5s ease;
}

.carousel-viewport > .carousel-slide-prev {
  visibility: visible;
  transition: transform 0.5s ease;
}

/* Forward: prev exits left, next enters from right */
.carousel-forward > .carousel-viewport > .carousel-slide-prev {
  transform: translateX(-100%);
}

.carousel-forward > .carousel-viewport > .carousel-slide-next {
  transform: translateX(100%);
  visibility: visible;
}

/* Backward: prev exits right, next enters from left */
.carousel-backward > .carousel-viewport > .carousel-slide-prev {
  transform: translateX(100%);
}

.carousel-backward > .carousel-viewport > .carousel-slide-next {
  transform: translateX(-100%);
  visibility: visible;
}

/* Carousel frontend controls */

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 1rem 0 2rem;
}

.carousel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  --size: clamp(25px, 8vw, 48px);
  width: var(--size);
  height: var(--size);
  padding: 0;
  padding-bottom: clamp(3px, 1.1vw, 10px);
  border: none;
  border-radius: 50%;
  background-color: rgba(46, 46, 46, 0.7);
  backdrop-filter: blur(10px);
  color: white;
  font-weight: 150;
  font-family: system-ui, sans-serif;
  font-size: var(--size);
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
  transition: background 0.15s ease;
}

.carousel-btn-prev {
  left: 12px;
  padding-right: 2px;
}

.carousel-btn-next {
  right: 12px;
  padding-left: 2px;
}

.carousel-btn:hover {
  background-color: rgba(33, 33, 33, 0.85);
}

.carousel-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.carousel-dot:hover {
  background: rgba(0, 0, 0, 0.4);
}

.carousel-dot-active {
  background: currentColor;
  transform: scale(1.25);
}

/* Carousel editor navigation bar */

.carousel-nav-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.carousel-nav-bar .components-button {
  padding: 4px 10px;
  min-height: 0;
  font-size: 13px;
  line-height: 1.4;
}

.carousel-nav-bar .components-button.is-active {
  background: #007cba;
  color: #fff;
}

.carousel-nav-bar .carousel-add-slide {
  margin-left: auto;
  background: #007cba;
  color: #fff;
}

.carousel-nav-bar .carousel-add-slide:hover {
  background: #006ba1;
  color: #fff;
}

/* Carousel slide in editor — propagate height through InnerBlocks wrappers */

.wp-block-custom-carousel > .carousel-slides-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.wp-block-custom-carousel
  > .carousel-slides-container
  > .block-editor-inner-blocks,
.wp-block-custom-carousel
  > .carousel-slides-container
  > .block-editor-inner-blocks
  > .block-editor-block-list__layout {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.wp-block-custom-carousel
  > .carousel-slides-container
  [data-type="custom/carousel-slide"] {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.wp-block-custom-carousel
  > .carousel-slides-container
  [data-type="custom/carousel-slide"]
  > .carousel-slide {
  flex: 1 1 auto;
  min-height: 100px;
  padding: 16px;
}

/* Swipe gestures: prevent text selection and native drag; allow vertical scroll */

.carousel-viewport {
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

.carousel-viewport img,
.carousel-viewport a,
.carousel-viewport video {
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

/* Fixed height mode (frontend) */

.carousel-is-fixed-height .carousel-viewport {
  height: 100%;
}

.carousel-is-fixed-height .carousel-viewport > .wp-block-custom-carousel-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Fixed height mode (editor) */

.carousel-is-fixed-height > .carousel-slides-container,
.carousel-is-fixed-height
  > .carousel-slides-container
  > .block-editor-inner-blocks,
.carousel-is-fixed-height
  > .carousel-slides-container
  > .block-editor-inner-blocks
  > .block-editor-block-list__layout {
  overflow: hidden;
}

.carousel-is-fixed-height
  > .carousel-slides-container
  [data-type="custom/carousel-slide"]
  > .carousel-slide {
  overflow: hidden;
}

/*
 * CUSTOM Tabs block
 */

.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  border-bottom: 1px solid var(--wp--preset--color--gray-300);
}

.tab-button {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 0.5em 1em;
  cursor: pointer;
  font-family: "Overpass Mono", ui-monospace;
  text-transform: uppercase;
  color: inherit;
}

@media (min-width: 801px) {
  .tab-button {
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    padding: 0.5em 1.5em;
  }
}

.tab-button.is-active {
  border-bottom-color: var(--wp--preset--color--gray-800);
  font-weight: 700;
}

/* Hide non-active tabs once JS has initialized; all visible without JS */
.tabs-initialized .wp-block-custom-tab {
  display: none;
}

.tabs-initialized .wp-block-custom-tab.is-active {
  display: block;
}

/*
 * CUSTOM Parallax block
 */

.wp-block-custom-parallax {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  margin-top: 0;
  margin-bottom: 0;
}

.wp-block-custom-parallax.is-vertically-aligned-center {
  justify-content: center;
}

.wp-block-custom-parallax.is-vertically-aligned-bottom {
  justify-content: flex-end;
}

.wp-block-custom-parallax,
.wp-block-custom-parallax *,
.wp-block-custom-parallax *::before,
.wp-block-custom-parallax *::after {
  box-sizing: border-box;
}

.wp-block-custom-parallax .parallax-bg {
  position: absolute;
  top: -25%;
  left: 0;
  width: 100%;
  height: 150%;
  pointer-events: none;
  will-change: transform;
}

.wp-block-custom-parallax .parallax-bg-image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.wp-block-custom-parallax .parallax-bg video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wp-block-custom-parallax .parallax-mono {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wp-block-custom-parallax .parallax-gradient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: color;
}

.wp-block-custom-parallax .parallax-content {
  position: relative;
  z-index: 1;
}

@keyframes parallax-build-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wp-block-custom-parallax .parallax-content.is-build-in {
  animation: parallax-build-in 0.8s ease both;
}

.wp-block-custom-parallax .parallax-bg-placeholder {
  width: 100%;
  height: 100%;
  background: #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #757575;
  font-size: 13px;
}

/* Editor toolbar */
.tabs-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 8px;
}

.tabs-editor-toolbar .components-button {
  padding: 4px 10px;
  min-height: 0;
  font-size: 13px;
  line-height: 1.4;
}

.tabs-editor-toolbar .tabs-add-tab {
  background: #007cba;
  color: #fff;
}

.tabs-editor-toolbar .tabs-add-tab:hover:not(:disabled) {
  background: #006ba1;
  color: #fff;
}

.tabs-editor-toolbar .tabs-add-tab:disabled {
  opacity: 0.4;
}

/* ============================================================
   custom/swipe-gallery
   ============================================================ */

/* Editor: thumbnail strip (mirrors the frontend's horizontal layout, height-capped) */
.swipe-gallery-editor-ui {
  padding: 8px;
}

.swipe-gallery-editor-strip {
  position: relative;
  margin-bottom: 10px;
}

.swipe-gallery-editor-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 6px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 6px;
}

.swipe-gallery-editor-thumb {
  position: relative;
  flex: 0 0 auto;
  height: var(--swipe-gallery-editor-thumb-height, 190px);
  width: auto;
  /* aspect-ratio is set inline from the block attribute */
}

/* Filmstrip tiles: width tracks the Tile width (vw) control, height follows
   the shared Aspect ratio control — same calc as the frontend */
.swipe-gallery-editor-thumb--filmstrip {
  width: calc(var(--swipe-gallery-tile-size, 15) * 1vw);
  height: auto;
}

.swipe-gallery-editor-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.swipe-gallery-editor-remove {
  position: absolute !important;
  top: 3px;
  right: 3px;
  width: 20px !important;
  height: 20px !important;
  min-width: 0 !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: rgba(0, 0, 0, 0.55) !important;
  color: #fff !important;
  font-size: 14px;
  line-height: 1;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* Click-to-page nav over the editor strip — pseudo-swipe, mirrors the frontend arrows */
.swipe-gallery-editor-nav {
  position: absolute !important;
  top: 0;
  bottom: 6px;
  width: 28px !important;
  min-width: 0 !important;
  padding: 0 !important;
  border-radius: 4px !important;
  background: rgba(0, 0, 0, 0.45) !important;
  color: #fff !important;
  font-size: 20px;
  line-height: 1;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.swipe-gallery-editor-nav-prev {
  left: 0;
}

.swipe-gallery-editor-nav-next {
  right: 0;
}

/* Frontend: slides use the configured aspect ratio */
.wp-block-custom-swipe-gallery .swiper-slide {
  width: var(--swipe-gallery-slide-width, 70%);
  height: auto;
  aspect-ratio: var(--swipe-gallery-aspect-ratio, 16/9);
  overflow: hidden;
}

/* Media fills slides */
.wp-block-custom-swipe-gallery .swiper-slide img,
.wp-block-custom-swipe-gallery .swiper-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* White nav arrows and pagination dot */
.wp-block-custom-swipe-gallery {
  --swiper-navigation-color: #ffffff;
  --swiper-pagination-color: #ffffff;
}

.wp-block-custom-swipe-gallery .swiper-button-prev,
.wp-block-custom-swipe-gallery .swiper-button-next {
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
}

/* Filmstrip style: small vw-wide tiles instead of one large peeked slide.
   Height still comes from the generic aspect-ratio rule below. */
.wp-block-custom-swipe-gallery.swipe-gallery-style-filmstrip .swiper-slide {
  width: calc(var(--swipe-gallery-tile-size, 15) * 1vw);
}

.wp-block-custom-swipe-gallery.swipe-gallery-style-filmstrip .swiper-pagination {
  display: none;
}

.wp-block-custom-swipe-gallery.swipe-gallery-style-filmstrip {
  --swiper-navigation-size: 20px;
}

/*
 * CUSTOM Fade Group block
 */

.wp-block-custom-fade-group {
  --fade-group-offset: -1vw;
  opacity: 0;
  transform: translateY(var(--fade-group-offset));
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.editor-styles-wrapper .wp-block-custom-fade-group,
.wp-block-custom-fade-group.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.wp-block-custom-fade-group.is-duration-long {
  transition-duration: 1.1s;
}

.wp-block-custom-fade-group.is-offset-large {
  --fade-group-offset: -3vw;
}

@media (prefers-reduced-motion: reduce) {
  .wp-block-custom-fade-group {
    transition: none;
  }
}

/*
 * CUSTOM Hotspot Map block
 */

.wp-block-custom-hotspot-map .hotspot-map-inner {
  position: relative;
}

.wp-block-custom-hotspot-map .hotspot-map-inner img {
  display: block;
  width: 100%;
  height: auto;
}

.wp-block-custom-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.wp-block-custom-hotspot .hotspot-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: rgba(0, 204, 82, 0.9);
  border: 1px solid #00b752;
  box-shadow: 0 0 0 4px hsla(144, 90%, 40%, 0.5);
  cursor: pointer;
  position: relative;
  transform: scale(1);
  animation: pulse-hotspot 3.75s ease forwards infinite;
  &:after {
    content: "";
    animation: pulse-hotspot-glow 3.75s linear forwards infinite;
    position: absolute;
    background-color: hsla(144, 90%, 40%, 0.5);
    top: 50%;
    left: 50%;
    border-radius: 99px;
    opacity: 1;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes pulse-hotspot {
  0% {
    transform: scale(1);
  }
  11% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulse-hotspot-glow {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  22% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

.wp-block-custom-hotspot .hotspot-tooltip {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 220px;
  text-fit: pretty;
  padding: 10px 14px 12px;
  background-color: rgba(16, 13, 26, 0.8);
  backdrop-filter: blur(5px);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
  border-radius: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2;
}

.wp-block-custom-hotspot.tooltip-right .hotspot-tooltip {
  left: calc(100% + 14px);
}

.wp-block-custom-hotspot.tooltip-left .hotspot-tooltip {
  right: calc(100% + 14px);
}

.wp-block-custom-hotspot:hover .hotspot-tooltip,
.wp-block-custom-hotspot.is-open .hotspot-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Always show tooltip content in the editor so it stays easy to edit
   regardless of cursor position. */
.editor-styles-wrapper .wp-block-custom-hotspot .hotspot-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
