/*
 * Visual layers for the Effect field.
 *
 * The flip card, polaroid scatter, tear-off ticket, hinged panel and push button
 * adapt snippets from CSS 3D Lab (https://github.com/Evirtual/css-3d-lab),
 * models flip, polaroid, ticket, accordion and button.
 * Those snippets are MIT licensed. The rest of that repository is not.
 *
 * MIT License
 *
 * Copyright (c) 2026 Edgaras Neverdauskas
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

.zo-flip {
  height: 280px;
  perspective: 900px;
  cursor: pointer;
  outline: none;
}

.zo-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.zo-flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  backface-visibility: hidden;
}

.zo-flip-back {
  justify-content: flex-start;
  padding: 16px;
  background: #fff;
  transform: rotateY(180deg);
}

.zo-polaroid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.zo-polaroid-card {
  display: block;
  width: 100%;
  padding: 10px 10px 28px;
  border: 0;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 10px 24px rgb(15 23 42 / 0.16);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.zo-polaroid-photo {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #e2e8f0;
}

.zo-polaroid-card small {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.zo-hinge {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  perspective: 800px;
}

.zo-hinge summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 650;
  list-style: none;
}

.zo-hinge summary::-webkit-details-marker {
  display: none;
}

.zo-hinge-panel {
  padding: 0 18px 16px;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
  transform-origin: top center;
}

@media (min-width: 768px) {
  .zo-polaroid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .zo-flip-inner,
  .zo-polaroid-card,
  .zo-hinge-panel,
  [data-effect="ticket"] .zo-actie-stub,
  [data-effect="push"] .zo-btn {
    transition: transform 0.45s cubic-bezier(0.3, 1.2, 0.5, 1);
  }

  .zo-flip.is-flipped .zo-flip-inner,
  .zo-flip:focus-visible .zo-flip-inner {
    transform: rotateY(180deg);
  }

  .zo-hinge[open] .zo-hinge-panel {
    transform: rotateX(0deg);
  }

  @starting-style {
    .zo-hinge[open] .zo-hinge-panel {
      transform: rotateX(-88deg);
    }
  }

  [data-effect="ticket"] .zo-actie-stub {
    transform-origin: 0 92%;
  }

  [data-effect="ticket"] .zo-actie-ticket:focus-within .zo-actie-stub {
    transform: rotateZ(16deg) rotateY(24deg);
  }

  [data-effect="push"] .zo-btn {
    box-shadow: 0 4px 0 color-mix(in srgb, var(--color-accent, #0f766e) 70%, #000);
  }

  [data-effect="push"] .zo-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 color-mix(in srgb, var(--color-accent, #0f766e) 70%, #000);
  }

  @media (hover: hover) {
    .zo-flip:hover .zo-flip-inner {
      transform: rotateY(180deg);
    }

    .zo-polaroid-card:hover,
    .zo-polaroid-card:focus-visible {
      transform: rotate(0deg) translateY(-10px);
    }

    [data-effect="ticket"] .zo-actie-ticket:hover .zo-actie-stub {
      transform: rotateZ(16deg) rotateY(24deg);
    }

    [data-effect="push"] .zo-btn:hover {
      transform: translateY(2px);
      box-shadow: 0 2px 0 color-mix(in srgb, var(--color-accent, #0f766e) 70%, #000);
    }
  }

  @media (min-width: 768px) {
    .zo-polaroid-card {
      transform: rotate(var(--r, 0deg));
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .zo-flip {
    height: auto;
  }

  .zo-flip-inner,
  .zo-flip-face,
  .zo-flip-back,
  .zo-polaroid-card,
  .zo-hinge-panel,
  [data-effect="ticket"] .zo-actie-stub,
  [data-effect="push"] .zo-btn {
    position: static;
    transform: none;
    transition: none;
    backface-visibility: visible;
  }

  .zo-hinge:not([open]) .zo-hinge-panel {
    display: none;
  }
}
