/*
  CSS Image Split Animation
  The original video shows these custom properties and split-half rules.
*/
:root {
  --anim-speed: 0.6s;
  --anim-curve: cubic-bezier(0.25, 1, 0.5, 1);
  --split-distance: 60%;
  --img-url: url("https://picsum.photos/id/1067/800/500");
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  background: #f5f5f5;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
}

.showcase {
  width: min(100%, 760px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
  gap: 20px;
}

.page-label {
  margin: 0 0 8px;
  color: #3384d9;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  text-shadow: 0 1px 2px #3384d955;
}

/* Original recording: width 470px; height 325px; radius 12px. */
.split-container {
  --card-width: min(470px, calc(100vw - 44px));
  position: relative;
  width: var(--card-width);
  aspect-ratio: 470 / 325;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: #111;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .3);
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.reveal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: #fff;
  text-align: center;
  z-index: 1;
  font-family: "Arial Black", Arial, sans-serif;
  letter-spacing: 4px;
  pointer-events: none;
}

.reveal-title {
  font-size: clamp(15px, 3vw, 19px);
  font-weight: 900;
  margin-bottom: 9px;
}

.reveal-subtitle {
  font-size: clamp(10px, 2vw, 13px);
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: 3px;
}

.reveal-icon {
  margin-top: 13px;
  font-size: 15px;
  letter-spacing: 0;
}

.split-half {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background-image: var(--img-url);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  z-index: 2;
  transition: transform var(--anim-speed) var(--anim-curve);
  will-change: transform;
}

.split-half.left {
  left: 0;
  background-position: left center;
  transform-origin: left center;
}

.split-half.right {
  right: 0;
  background-position: right center;
  transform-origin: right center;
}

.split-container:hover .split-half.left,
.split-container.is-open .split-half.left {
  transform: translateX(calc(-1 * var(--split-distance)));
}

.split-container:hover .split-half.right,
.split-container.is-open .split-half.right {
  transform: translateX(var(--split-distance));
}

.hint {
  margin: 8px 0 0;
  color: #777;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .2em;
  text-align: center;
}

@media (max-width: 480px) {
  .showcase { padding: 24px 14px; }
  .page-label { font-size: 11px; }
  .split-container { border-radius: 9px; }
  :root { --split-distance: 58%; }
}

@media (prefers-reduced-motion: reduce) {
  .split-half { transition-duration: .01ms; }
}
