/* ============================================================
   MY FÊTE TICKETS — TICKET LOADER
   Shared by index.html, signin.html and organizer-signup.html.
   Pair with assets/loader.js.
   ============================================================ */
/* Scoped to the loader, not :root. This file is linked after the page's own
   stylesheet, so declaring brand tokens globally here silently repainted the
   whole palette — orange buttons came back pink. The loader's own elements
   are all inside .tload, which is where these belong. Values track the brand
   palette in site-chrome.css; keep them in step. */
.tload{
  --pink:#f7941d;
  --plum-900:#24103a;
  --cream:#fff5e8;
  --ink-soft:#6c6475;
}
/* ============================================================
     TICKET LOADER
     Loops while waiting, then plays a one-off exit: the sale completes,
     the stub is cut, the halves come apart.
     ============================================================ */
  .tload{
    position:fixed;inset:0;z-index:9999;
    display:flex;flex-direction:column;align-items:center;justify-content:center;gap:26px;
    background:var(--cream);
    transition:opacity .4s ease, visibility .4s ease;
  }
  .tload.is-done{opacity:0;visibility:hidden;pointer-events:none;}

  .tload-stage{position:relative;display:flex;flex-direction:column;align-items:center;}
  .tload-ticket{
    position:relative;display:flex;width:252px;height:98px;
    border-radius:13px;overflow:hidden;background:var(--plum-900);
    animation:ttBob 2.1s ease-in-out infinite;
  }
  @keyframes ttBob{
    0%,100%{transform:translateY(0) rotate(-1.2deg);}
    50%    {transform:translateY(-7px) rotate(1.2deg);}
  }
  .tload-shadow{
    width:150px;height:13px;border-radius:50%;margin-top:16px;
    background:radial-gradient(ellipse at center, rgba(43,14,44,0.26), transparent 70%);
    animation:ttShadow 2.1s ease-in-out infinite;
  }
  @keyframes ttShadow{
    0%,100%{transform:scale(1);opacity:.85;}
    50%    {transform:scale(.8);opacity:.5;}
  }

  .tt-half{position:relative;z-index:3;display:flex;align-items:center;justify-content:center;}
  .tt-left{flex:1.55;flex-direction:column;gap:9px;}
  .tt-right{flex:1;background:rgba(0,0,0,0.24);}
  .tt-admit{
    font-family:'Sora',sans-serif;font-size:11px;font-weight:800;
    letter-spacing:0.18em;text-transform:uppercase;color:rgba(255,255,255,0.85);
  }
  .tt-code{
    width:76px;height:22px;
    background:repeating-linear-gradient(90deg,
      rgba(255,255,255,0.85) 0 2px, transparent 2px 4px,
      rgba(255,255,255,0.85) 4px 7px, transparent 7px 9px);
  }
  .tt-logo{font-family:'Sora',sans-serif;font-size:22px;font-weight:800;color:#fff;}

  .tt-perf{
    position:absolute;left:60.5%;top:0;bottom:0;width:0;z-index:4;background:var(--cream);
    box-shadow:inset 2px 0 0 rgba(0,0,0,0.12), inset -2px 0 0 rgba(0,0,0,0.12);
  }
  .tt-perf::before{
    content:"";position:absolute;left:-2px;top:9px;bottom:9px;
    border-left:2px dashed rgba(255,255,255,0.34);
  }

  /* WAITING: a pink band travels across, and a highlight sweeps over the top */
  .tt-band{
    position:absolute;top:0;bottom:0;left:0;width:55%;z-index:1;
    background:linear-gradient(90deg, transparent, var(--pink) 28%, #ffb866 72%, transparent);
    animation:ttBand 1.35s cubic-bezier(.55,0,.45,1) infinite;
  }
  @keyframes ttBand{
    0%  {transform:translateX(-100%);}
    100%{transform:translateX(252px);}
  }
  .tt-scan{
    position:absolute;inset:0;z-index:5;pointer-events:none;
    background:linear-gradient(104deg, transparent 38%, rgba(255,255,255,0.3) 50%, transparent 62%);
    transform:translateX(-110%);
    animation:ttScan 1.35s linear infinite;
  }
  @keyframes ttScan{ to{ transform:translateX(110%); } }

  /* EXIT: fill completes, stub is cut, halves separate */
  .tt-fill{
    position:absolute;inset:0;z-index:2;
    background:linear-gradient(90deg,var(--pink),#ffb866);
    transform:scaleX(0);transform-origin:left center;
  }
  .tload.is-ready .tt-band{animation:none;opacity:0;transition:opacity .2s ease;}
  .tload.is-ready .tt-scan{animation:none;opacity:0;}
  .tload.is-ready .tload-ticket{animation:none;transform:translateY(0) rotate(0deg);transition:transform .3s ease;}
  .tload.is-ready .tload-shadow{animation:none;}
  .tload.is-ready .tt-fill{animation:ttFill .42s cubic-bezier(.5,0,.3,1) forwards;}
  .tload.is-ready .tt-perf{animation:ttCut .26s cubic-bezier(.5,0,.3,1) .42s forwards;}
  .tload.is-ready .tt-perf::before{animation:ttPerfOut .18s ease .42s forwards;}
  .tload.is-ready .tt-left {animation:ttTearL .34s cubic-bezier(.4,0,.25,1) .6s forwards;}
  .tload.is-ready .tt-right{animation:ttTearR .34s cubic-bezier(.4,0,.25,1) .6s forwards;}
  @keyframes ttFill   { to{ transform:scaleX(1); } }
  @keyframes ttCut    { to{ width:18px; } }
  @keyframes ttPerfOut{ to{ opacity:0; } }
  @keyframes ttTearL  { to{ transform:translateX(-13px) rotate(-3deg); } }
  @keyframes ttTearR  { to{ transform:translateX(13px)  rotate(3deg);  } }

  .tload-label{
    display:flex;align-items:center;gap:3px;
    font-size:13px;font-weight:700;letter-spacing:0.04em;color:var(--ink-soft);
  }
  .tload-label i{
    width:3px;height:3px;border-radius:50%;background:var(--pink);
    animation:ttDot 1.1s ease-in-out infinite;
  }
  .tload-label i:first-of-type{margin-left:4px;}
  .tload-label i:nth-of-type(2){animation-delay:.16s;}
  .tload-label i:nth-of-type(3){animation-delay:.32s;}
  @keyframes ttDot{
    0%,70%,100%{opacity:.25;transform:translateY(0);}
    35%        {opacity:1;transform:translateY(-3px);}
  }

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


/* leaving a page: fade the overlay in rather than out */
.tload.is-leaving{opacity:0;visibility:visible;}
.tload.is-leaving.is-visible{opacity:1;}

/* narrow phones: the ticket was taking most of the screen width */
@media (max-width:400px){
  .tload-ticket{width:210px;height:82px;}
  .tt-code{width:62px;height:18px;}
  .tt-logo{font-size:19px;}
  .tload-shadow{width:126px;}
  @keyframes ttBand{0%{transform:translateX(-100%);}100%{transform:translateX(210px);}}
}
