/* ============================================================
   Grand opening — two palace doors, an invitation, and the
   warm light behind them.

   Same palette and type as the rest of the album. Deep rosewood,
   thin brass lines, nothing that glitters.
   ============================================================ */

#opening{display:none}

/* only a first-time visitor sees it; the class is set before first paint */
html.first-visit #opening,
html.replaying #opening{
  display:block;position:fixed;inset:0;z-index:500;
  background:#0d0907;overflow:hidden;
  perspective:1900px;perspective-origin:50% 46%;
}
html.first-visit body,html.replaying body{overflow:hidden}

/* ------------------------------------------------------ behind the doors --- */
.op-back{position:absolute;inset:0;overflow:hidden;background:#0d0907}
.op-hero{
  position:absolute;inset:0;
  background-size:cover;background-position:center 26%;
  transform:scale(1.14);opacity:.28;filter:saturate(.86) brightness(.72);
}
/* the warm light that spills out as the doors part */
.op-lamp{
  position:absolute;inset:0;opacity:0;
  background:
    radial-gradient(38% 52% at 50% 52%, rgba(255,214,150,.62), transparent 68%),
    radial-gradient(78% 90% at 50% 60%, rgba(196,148,84,.34), transparent 74%);
}

/* ---------------------------------------------------------------- doors --- */
.op-door{
  position:absolute;top:-2%;height:104%;width:50.4%;
  transform-style:preserve-3d;backface-visibility:hidden;
  will-change:transform;
}
.op-left {left:0;  transform-origin:left center; transform:rotateY(0deg)}
.op-right{right:0; transform-origin:right center;transform:rotateY(0deg)}

.op-face{
  position:absolute;inset:0;overflow:hidden;
  background:
    linear-gradient(90deg,rgba(0,0,0,.42) 0%,rgba(0,0,0,0) 14%,
                          rgba(0,0,0,0) 86%,rgba(0,0,0,.30) 100%),
    repeating-linear-gradient(90deg,
      rgba(255,255,255,.014) 0 2px, rgba(0,0,0,.020) 2px 5px),
    linear-gradient(160deg,#3a241b 0%,#2a1811 42%,#1d0f0b 100%);
  box-shadow:inset 0 0 120px rgba(0,0,0,.62);
}
.op-left  .op-face{border-right:1px solid rgba(0,0,0,.6)}
.op-right .op-face{border-left:1px solid rgba(0,0,0,.6)}

/* an arched brass frame; the two halves meet as one arch */
.op-arch{
  position:absolute;top:4.5%;bottom:5%;
  border:1px solid rgba(190,152,94,.42);
  box-shadow:inset 0 0 0 1px rgba(255,220,170,.07),
             0 0 44px rgba(0,0,0,.5);
}
.op-left  .op-arch{left:8%;right:0;  border-right:0;border-top-left-radius:92% 46%}
.op-right .op-arch{right:8%;left:0;  border-left:0; border-top-right-radius:92% 46%}

/* fine vertical inlay, and a jali so faint it reads as grain */
.op-inlay{
  position:absolute;top:9%;bottom:9.5%;
  background-image:
    linear-gradient(90deg,rgba(190,152,94,.20) 0 1px,transparent 1px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34'%3E%3Cg fill='none' stroke='%23d8bd8a' stroke-opacity='.055' stroke-width='.55'%3E%3Cpath d='M17 1 33 17 17 33 1 17Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size:auto,34px 34px;
  background-repeat:no-repeat,repeat;
}
.op-left  .op-inlay{left:13%;right:5%;  background-position:right top,0 0}
.op-right .op-inlay{right:13%;left:5%;  background-position:left top,0 0}

/* a single restrained medallion, low on the panel */
.op-medal{
  position:absolute;top:70%;width:118px;height:118px;
  transform:translate(-50%,-50%);left:50%;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23c9a86a' stroke-opacity='.32' stroke-width='1'%3E%3Ccircle cx='60' cy='60' r='46'/%3E%3Ccircle cx='60' cy='60' r='34'/%3E%3Cpath d='M60 20c8 14 8 26 0 40-8-14-8-26 0-40Z'/%3E%3Cpath d='M60 60c8 14 8 26 0 40-8-14-8-26 0-40Z'/%3E%3Cpath d='M20 60c14-8 26-8 40 0-14 8-26 8-40 0Z'/%3E%3Cpath d='M60 60c14-8 26-8 40 0-14 8-26 8-40 0Z'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat;
  opacity:.62;
}


/* brass ring pulls, close to where the doors meet */
.op-ring{
  position:absolute;top:52%;width:34px;height:34px;border-radius:50%;
  border:2px solid rgba(206,170,108,.55);
  box-shadow:0 2px 10px rgba(0,0,0,.6),inset 0 1px 0 rgba(255,226,180,.30);
}
.op-left  .op-ring{right:5.2%}
.op-right .op-ring{left:5.2%}

/* the lit seam where the two doors meet */
.op-edge{
  position:absolute;top:0;bottom:0;width:3px;
  background:linear-gradient(180deg,transparent,rgba(255,206,140,.5) 22%,
                             rgba(255,206,140,.5) 78%,transparent);
  opacity:.5;
}
.op-left  .op-edge{right:0}
.op-right .op-edge{left:0}

/* ----------------------------------------------------------- invitation --- */
.op-card{
  position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  width:min(560px,86vw);text-align:center;color:#f4ead9;
  z-index:6;
}
.op-crest svg{
  width:64px;height:26px;fill:none;stroke:rgba(201,168,106,.9);
  stroke-width:1.1;stroke-linecap:round;
}
.op-eyebrow{
  margin:16px 0 0;font-size:10.5px;letter-spacing:.36em;text-transform:uppercase;
  color:rgba(226,206,172,.72);
}
.op-names{
  font-family:var(--serif);font-weight:300;margin:14px 0 0;
  font-size:clamp(38px,7.4vw,74px);line-height:1.12;
  text-shadow:0 2px 30px rgba(0,0,0,.7);
}
.op-names em{
  display:block;font-size:.34em;font-style:italic;
  color:var(--gold-soft);margin:6px 0;letter-spacing:.06em;
}
.op-date{
  margin:20px 0 0;font-size:11.5px;letter-spacing:.34em;text-transform:uppercase;
  color:rgba(226,206,172,.82);
}
.op-enter{
  margin-top:34px;padding:15px 38px;border-radius:2px;color:#f6efe2;
  border:1px solid rgba(201,168,106,.55);
  font-size:11px;letter-spacing:.26em;text-transform:uppercase;
  background:rgba(255,226,180,.05);
  transition:background .5s var(--ease),border-color .5s var(--ease),
             letter-spacing .5s var(--ease);
}
.op-enter:hover{
  background:rgba(255,226,180,.13);border-color:rgba(216,188,134,.85);
  letter-spacing:.3em;
}
.op-skip{
  position:absolute;right:20px;bottom:18px;z-index:7;
  padding:9px 16px;font-size:10px;letter-spacing:.22em;text-transform:uppercase;
  color:rgba(232,216,188,.5);transition:color .4s;
}
.op-skip:hover{color:rgba(244,234,217,.95)}

/* --------------------------------------------------------------- petals --- */
.op-petals{position:absolute;inset:0;z-index:5;pointer-events:none;overflow:hidden}
.op-petal{
  position:absolute;top:-8%;border-radius:60% 40% 55% 45%;
  background:linear-gradient(140deg,rgba(255,226,196,.5),rgba(214,158,120,.32));
  opacity:0;filter:blur(.3px);
}

/* ------------------------------------------------------------ the entry --- */
#opening.op-go .op-card{
  opacity:0;transform:translate(-50%,-64%);
  transition:opacity .55s var(--ease),transform .9s var(--ease);
  pointer-events:none;
}
#opening.op-go .op-skip{opacity:0;transition:opacity .4s;pointer-events:none}
#opening.op-go .op-edge{opacity:0;transition:opacity .7s}

#opening.op-go .op-left,
#opening.op-go .op-right{
  animation-duration:2900ms;
  animation-timing-function:cubic-bezier(.62,.02,.22,1);
  animation-fill-mode:forwards;
  animation-iteration-count:1;
}
#opening.op-go .op-left { animation-name:swingL }
#opening.op-go .op-right{ animation-name:swingR }
@keyframes swingL{
  0%  {transform:rotateY(0deg)}
  7%  {transform:rotateY(1.6deg)}          /* the latch giving way */
  100%{transform:rotateY(-104deg)}
}
@keyframes swingR{
  0%  {transform:rotateY(0deg)}
  7%  {transform:rotateY(-1.6deg)}
  100%{transform:rotateY(104deg)}
}
#opening.op-go .op-lamp{
  animation-name:lamp;animation-duration:2900ms;
  animation-timing-function:cubic-bezier(.4,0,.3,1);animation-fill-mode:forwards;
}
@keyframes lamp{
  0%{opacity:0} 34%{opacity:.95} 100%{opacity:.22}
}
#opening.op-go .op-hero{
  animation-name:heroIn;animation-duration:3000ms;
  animation-timing-function:cubic-bezier(.3,0,.2,1);animation-fill-mode:forwards;
}
@keyframes heroIn{
  0%{transform:scale(1.14);opacity:.28;filter:saturate(.86) brightness(.72)}
  100%{transform:scale(1);opacity:1;filter:saturate(1) brightness(1)}
}

/* doors are gone; hand over to the page underneath */
#opening.op-done{
  opacity:0;transition:opacity 850ms var(--ease);pointer-events:none;
}

/* ---------------------------------------------------------------- phone --- */
@media(max-width:700px){
  html.first-visit #opening,html.replaying #opening{perspective:1200px}
  .op-medal{display:none}
  .op-inlay{background-image:linear-gradient(90deg,rgba(190,152,94,.18) 0 1px,transparent 1px)}
  .op-ring{width:24px;height:24px;top:64%}   /* clear of the names */
  .op-arch{top:5.5%;bottom:6%}
  #opening.op-go .op-left { animation-duration:2400ms }
  #opening.op-go .op-right{ animation-duration:2400ms }
  #opening.op-go .op-lamp,#opening.op-go .op-hero{animation-duration:2500ms}
}

/* ------------------------------------------------------ reduced motion --- */
@media(prefers-reduced-motion:reduce){
  .op-petals{display:none}
  #opening.op-go .op-left,#opening.op-go .op-right{
    animation:none;transform:none;opacity:0;
    transition:opacity 900ms ease;
  }
  #opening.op-go .op-lamp{animation:none;opacity:.3;transition:opacity 900ms ease}
  #opening.op-go .op-hero{
    animation:none;transform:none;opacity:1;filter:none;
    transition:opacity 900ms ease,filter 900ms ease;
  }
  .op-enter:hover{letter-spacing:.26em}
}
