/**
 * AnimateBox.dev — Disc Wipe
 * https://animatebox.dev
 *
 * Full-viewport cover that iris-wipes (vén màn) via clip-path circle
 * into a brand origin. Theme via --ab-dw-* or factory options.
 * Solid backgrounds only.
 */

.ab-disc-wipe {
  --ab-dw-bg: #0b0b0c;
  --ab-dw-fg: #f3f1ec;
  --ab-dw-muted: rgba(243, 241, 236, 0.55);
  --ab-dw-bar: #f3f1ec;
  --ab-dw-bar-track: rgba(243, 241, 236, 0.12);
  --ab-dw-bar-height: 2px;
  --ab-dw-font: "DM Sans", "Avenir Next", "Segoe UI", sans-serif;
  --ab-dw-ox: 48px;
  --ab-dw-oy: 40px;
  --ab-dw-radius: 150vmax;
  --ab-dw-exit: 0.9s;
  --ab-dw-exit-ease: cubic-bezier(0.55, 0, 0.2, 1);

  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ab-dw-bg);
  color: var(--ab-dw-fg);
  font-family: var(--ab-dw-font);
  font-optical-sizing: auto;
  pointer-events: none;
  /* Full cover → shrinks as a circular curtain toward the origin */
  clip-path: circle(var(--ab-dw-radius) at var(--ab-dw-ox) var(--ab-dw-oy));
  transition: clip-path var(--ab-dw-exit) var(--ab-dw-exit-ease);
  will-change: clip-path;
}

.ab-disc-wipe.is-out {
  clip-path: circle(0px at var(--ab-dw-ox) var(--ab-dw-oy));
}

.ab-disc-wipe__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  height: var(--ab-dw-bar-height);
  background: var(--ab-dw-bar-track);
  overflow: hidden;
  pointer-events: none;
}

.ab-disc-wipe__bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ab-dw-bar);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.ab-disc-wipe__mid {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--ab-dw-fg);
  pointer-events: none;
}

.ab-disc-wipe__spin {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(243, 241, 236, 0.22);
  border-top-color: var(--ab-dw-fg);
  animation: ab-dw-spin 1.05s linear infinite;
}

.ab-disc-wipe__pct {
  margin: 0.55rem 0 0;
  font-size: clamp(2.75rem, 7vw, 4.75rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.ab-disc-wipe__note {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ab-dw-muted);
}

.ab-disc-wipe__live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ab-disc-wipe.is-snap,
.ab-disc-wipe.is-snap * {
  transition: none !important;
}

.ab-disc-wipe[data-paused] .ab-disc-wipe__spin {
  animation-play-state: paused !important;
}

@keyframes ab-dw-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ab-disc-wipe:not([data-force-motion]) .ab-disc-wipe__spin {
    animation: none !important;
  }

  .ab-disc-wipe:not([data-force-motion]) {
    transition: opacity 0.45s ease !important;
    clip-path: none !important;
  }

  .ab-disc-wipe:not([data-force-motion]).is-out {
    opacity: 0;
  }
}
