:root {
  --dream-flip-duration: 0.8s;
  --dream-flip-ease: cubic-bezier(0.4, 0.15, 0.1, 1);
  --dream-flip-shadow: rgba(15, 23, 42, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dream-flip-duration: 0.15s;
  }
}

.flip-container {
  --dream-flip-min-height: calc(100vh - 80px - 2rem);
  width: 100% !important;
  height: auto !important;
  min-height: var(--dream-flip-min-height) !important;
  max-width: 100% !important;
  position: relative !important;
  perspective: none !important;
  overflow: visible !important;
  isolation: isolate;
  filter: drop-shadow(0 20px 60px var(--dream-flip-shadow));
}

.flip-container .flipper {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  min-height: var(--dream-flip-min-height) !important;
  transform-style: flat !important;
  transform: none !important;
  display: grid !important;
  grid-template-areas: "flip" !important;
  transition: none !important;
}

.flip-container .front,
.flip-container .back {
  grid-area: flip;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: var(--dream-flip-min-height) !important;
  backface-visibility: visible !important;
  transform-origin: center !important;
  will-change: opacity, transform, filter;
  transition:
    opacity var(--dream-flip-duration) var(--dream-flip-ease),
    visibility var(--dream-flip-duration) var(--dream-flip-ease),
    transform var(--dream-flip-duration) var(--dream-flip-ease),
    filter var(--dream-flip-duration) var(--dream-flip-ease) !important;
}

.flip-container .front {
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 2 !important;
  transform: translateY(0) scale(1) !important;
  filter: blur(0) !important;
}

.flip-container .back {
  opacity: 0 !important;
  visibility: hidden !important;
  z-index: 1 !important;
  transform: translateY(24px) scale(0.98) !important;
  filter: blur(18px) !important;
  pointer-events: none;
}

.flip-container.flip-it .front {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(-28px) scale(0.96) !important;
  filter: blur(16px) !important;
  pointer-events: none;
}

.flip-container.flip-it .back {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1) !important;
  filter: blur(0) !important;
  pointer-events: auto;
}

.dream-origami-card {
  position: relative !important;
  overflow: hidden !important;
  border-radius: 1.25rem !important;
  border: 1px solid color-mix(in srgb, var(--fallback-bc, rgba(15,23,42,0.3)) 15%, transparent) !important;
  transition:
    transform 0.5s var(--dream-flip-ease),
    box-shadow 0.5s var(--dream-flip-ease),
    border-color 0.5s ease !important;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.dream-origami-card::before,
.dream-origami-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.dream-origami-card::before {
  inset: 0;
  background: linear-gradient(125deg, rgba(59, 130, 246, 0.14), transparent 45%);
  mix-blend-mode: screen;
  opacity: 0.4;
  transition: opacity 0.5s var(--dream-flip-ease);
}

.dream-origami-card::after {
  top: 0;
  right: 0;
  width: 140px;
  height: 140px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(59, 130, 246, 0.55));
  clip-path: polygon(100% 0%, 0% 0%, 100% 100%);
  box-shadow: -10px 10px 30px rgba(59, 130, 246, 0.25);
  transform-origin: top right;
  transform: rotateX(75deg) translate3d(0, -50%, 0);
  transition: transform 0.5s var(--dream-flip-ease), opacity 0.5s var(--dream-flip-ease);
  opacity: 0.35;
}

.dream-origami-card figure {
  overflow: hidden;
}

.dream-origami-card img {
  transition: transform 0.6s var(--dream-flip-ease), filter 0.6s var(--dream-flip-ease);
}

.dream-origami-card:hover {
  transform: translateY(-10px) scale(1.01);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.22);
  border-color: color-mix(in srgb, rgba(59, 130, 246, 0.65) 65%, transparent);
}

.dream-origami-card:hover::before {
  opacity: 0.75;
}

.dream-origami-card:hover::after {
  transform: rotateX(0deg) translate3d(0, 0, 0);
  opacity: 0.8;
}

.dream-origami-card:hover img {
  transform: scale(1.08);
  filter: saturate(1.15);
}

