/* ==========================================================
   curtain.css — the page-load reveal.
   The guest opens the wedding link and lands on a closed pair
   of curtains; they draw open slowly and gather into a tied
   drape at each side, framing the invitation underneath.
   js/animations/curtain.js drives the timeline; this file only
   defines how the fabric looks (folds, valance, tieback+tassel).
   ========================================================== */

body.curtain-locked {
  overflow: hidden;
  height: 100%;
}

.curtain-reveal {
  position: fixed;
  inset: 0;
  z-index: 500;
  overflow: hidden;
  /* Transparent on purpose — only the two fabric panels below should be
     opaque. The panels fully overlap and cover the viewport while closed,
     so nothing extra is needed here; and critically, as they gather open,
     the gap between them must show the actual invitation content, not a
     solid backdrop hiding it. */
  background: none;
  pointer-events: none;
}

.curtain-reveal.is-done {
  display: none;
}

/* -------- fabric panels -------- */
.curtain-reveal__panel {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 54%;
  /* Uses the active theme's own deep background color (--color-bg) as the
     base, so a royal-blue invitation gets a royal-blue curtain, a
     classic-gold invitation gets a warm gold-brown curtain, etc. — this
     always tracks whatever theme/color the person picked, instead of a
     fixed maroon. The fold texture and sheen below (::before / ::after)
     do the rest of the fabric look using plain black/white overlays, so
     they work the same regardless of what --color-bg is. */
  background: var(--color-bg, #1e120b);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.45) inset;
  will-change: transform;
}

.curtain-reveal__panel--left {
  left: 0;
  transform-origin: left center;
}

.curtain-reveal__panel--right {
  right: 0;
  transform-origin: right center;
}

/* vertical fold texture so each panel reads as fabric, not a flat block */
.curtain-reveal__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.22) 0,
    rgba(0, 0, 0, 0.22) 3px,
    rgba(255, 255, 255, 0.03) 3px,
    rgba(255, 255, 255, 0.03) 5px,
    transparent 5px,
    transparent 34px
  );
  pointer-events: none;
}

/* soft sheen down each panel for a velvet feel */
.curtain-reveal__panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 30% 0%,
    rgba(255, 255, 255, 0.12),
    transparent 55%
  );
  pointer-events: none;
}

.curtain-reveal__panel--left::before,
.curtain-reveal__panel--left::after {
  right: 0;
}

/* seam where the two panels meet before opening — a plain dark line
   works across every theme's background color */
.curtain-reveal__panel--left {
  border-right: 2px solid rgba(0, 0, 0, 0.35);
}

/* -------- top valance / pelmet -------- */
.curtain-reveal__valance {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  z-index: 2;
  background: linear-gradient(180deg, var(--color-bg, #1e120b), transparent);
  border-bottom: 2px solid var(--color-accent, #b8892f);
  -webkit-mask-image: radial-gradient(circle at 20px -4px, transparent 20px, #000 21px);
  mask-image: radial-gradient(circle at 20px -4px, transparent 20px, #000 21px);
  -webkit-mask-size: 40px 100%;
  mask-size: 40px 100%;
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
}

/* -------- tieback: a gold cord + tassel that appears once each
   panel has gathered, "tying" the curtain open -------- */
.curtain-reveal__tieback {
  position: absolute;
  top: 44%;
  width: 46px;
  height: 46px;
  opacity: 0;
  transform: scale(0.6);
  z-index: 3;
  pointer-events: none;
}

.curtain-reveal__panel--left .curtain-reveal__tieback {
  right: 6px;
}

.curtain-reveal__panel--right .curtain-reveal__tieback {
  left: 6px;
}

.curtain-reveal__tieback::before {
  /* the cord, wrapped around the gathered fabric */
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8d5a8, var(--color-accent, #b8892f));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.curtain-reveal__tieback::after {
  /* the tassel, hanging below the cord */
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 10px;
  height: 26px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    90deg,
    var(--color-accent, #b8892f) 0,
    var(--color-accent, #b8892f) 2px,
    #e8d5a8 2px,
    #e8d5a8 4px
  );
  border-radius: 0 0 5px 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .curtain-reveal {
    display: none;
  }
}
