/* =====================================================================================================================
   Moonfold · player account + CBT registration (account.html, register.html). Loads after site.css.
   Read as an illustrated in-game event invitation in the Dusk Gilt language (docs/ui-taste/analysis.md + spec.md):
   purple dusk ground (the game's assets/ui/bg/violet.jpg) under an ink veil, the in-game arched gilt frame
   (assets/ui/gilt/frame.webp) holding the invitation art, and a dark "letter" panel with a double gilt hairline,
   diamond nodes and a compass seal breaking its corner. Gilt stays at nodes; long edges get one hairline.
   Hooks kept from portal-account.js: .mast .brand nav .folio .art .sheet .back h1 .intro #account .actions .action
   .action.secondary details summary #feedback .small .muted .success h2.
   ===================================================================================================================== */
body[data-page]{
  --ac-ink:#08061a; --ac-tx:#fbf7ee; --ac-tx-2:#ddd7f2; --ac-tx-3:#b9b1de;
  --ac-gilt:#e9c97c; --ac-gilt-hi:#fff0c4; --ac-gilt-lo:#a07a2e; --ac-gilt-edge:#5c4416;
  --ac-cream:#f6ead2; --ac-cream-2:#ead8b2; --ac-cream-edge:#b9a274; --ac-navy:#1d2140;
  --ac-line:linear-gradient(90deg,transparent,var(--ac-gilt-lo) 10%,var(--ac-gilt) 30%,var(--ac-gilt-hi) 50%,var(--ac-gilt) 70%,var(--ac-gilt-lo) 90%,transparent);
  --ac-node:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M8 .5 13 8 8 15.5 3 8Z' fill='%23e9c97c' stroke='%235c4416' stroke-width='.7'/%3E%3Cpath d='M8 4.2 10.3 8 8 11.8 5.7 8Z' fill='%23fff0c4'/%3E%3C/svg%3E");
  --ac-e-out:cubic-bezier(.16,1,.3,1); --ac-e-ui:cubic-bezier(.23,1,.32,1); --ac-e-fold:cubic-bezier(.3,1.42,.6,1); --ac-e-draw:cubic-bezier(.65,0,.35,1);
  margin:0;min-height:100svh;display:flex;flex-direction:column;color:var(--ac-tx);background:#110d28;
  font:400 1rem/1.7 Anuphan,"Leelawadee UI",Tahoma,sans-serif;position:relative;isolation:isolate;overflow-x:hidden}
/* the dusk ground: in-game violet gradient, an ink veil so white text keeps contrast, a faint compass ring */
body[data-page]::before{content:"";position:fixed;inset:0;z-index:-2;pointer-events:none;
  background:radial-gradient(70% 55% at 72% 18%,rgba(184,174,230,.16),transparent 70%),
    linear-gradient(180deg,rgba(8,6,26,.58),rgba(8,6,26,.42) 38%,rgba(8,6,26,.86)),
    url(/assets/ui/bg/violet.jpg) center/cover no-repeat,#2b2456}
body[data-page]::after{content:"";position:fixed;z-index:-1;pointer-events:none;width:min(980px,150vw);aspect-ratio:1;left:50%;top:52%;
  translate:-50% -50%;background:url(/assets/ui/gilt/compass.webp) center/contain no-repeat;opacity:.075}
a{color:inherit}
:focus-visible,a:focus-visible,button:focus-visible{outline:3px solid #f0d23c;outline-offset:3px;border-radius:6px}
.skip{position:absolute;left:1rem;top:-6rem;z-index:20;background:var(--ac-cream);color:var(--ac-navy);padding:.7rem 1rem;border-radius:8px;font-weight:600;text-decoration:none}
.skip:focus{top:1rem}

/* ---------------------------------------------------------------- mast + footer (utility tier: hairline + diamond) */
.mast,footer{width:100%;max-width:1240px;margin-inline:auto;display:flex;align-items:center;justify-content:space-between;gap:1rem 2rem;padding:1.25rem clamp(1rem,5vw,4rem)}
.mast{position:relative}
.mast::after{content:"";position:absolute;left:clamp(1rem,5vw,4rem);right:clamp(1rem,5vw,4rem);bottom:0;height:1px;background:var(--ac-line);opacity:.55}
.brand{font:600 clamp(1.7rem,3vw,2.2rem)/1 Fraunces,Georgia,serif;letter-spacing:-.02em;text-decoration:none;color:var(--ac-gilt);
  background:linear-gradient(180deg,var(--ac-gilt-hi),var(--ac-gilt) 55%,#c9a24a);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;
  filter:drop-shadow(0 1px 0 rgba(6,4,18,.72))}
.mast nav{display:flex;flex-wrap:wrap;align-items:center;gap:.2rem .9rem;font-size:.95rem}
.mast nav a{position:relative;display:inline-flex;align-items:center;min-height:44px;padding:0 .2rem;text-decoration:none;color:var(--ac-tx-2);transition:color .2s}
.mast nav a+a::before{content:"";width:5px;height:5px;margin-right:.9rem;rotate:45deg;background:var(--ac-gilt);opacity:.7}
.mast nav a:hover{color:var(--ac-tx);text-decoration:underline;text-decoration-color:var(--ac-gilt);text-underline-offset:.35em}
footer{justify-content:center;flex-wrap:wrap;gap:.3rem 1.4rem;color:var(--ac-tx-3);font-size:.88rem;padding-block:1.6rem 2rem}
footer a{display:inline-flex;align-items:center;min-height:40px;text-decoration:none}
footer a+a::before{content:"";width:4px;height:4px;margin-right:1.4rem;rotate:45deg;background:var(--ac-gilt);opacity:.6}
footer a:hover{color:var(--ac-tx);text-decoration:underline;text-underline-offset:.3em}

/* ---------------------------------------------------------------- the invitation */
main{flex:1;display:grid;place-items:center;padding:clamp(1.5rem,4vw,3.5rem) clamp(1rem,5vw,4rem) clamp(2rem,5vw,4rem)}
.folio{position:relative;display:grid;grid-template-columns:minmax(0,.86fr) minmax(0,1fr);align-items:center;width:min(100%,1060px);
  background:none;border:0;box-shadow:none;color:var(--ac-tx);overflow:visible}

/* the art: invitation illustration inside the in-game arched gilt frame (frame.webp is 687x1000; its window is ~14.5–85.5% wide, 6–96.5% tall) */
.art{position:relative;z-index:2;justify-self:end;width:100%;max-width:470px;min-height:0;aspect-ratio:687/1000;margin-right:-34px;background:none}
.art::before{content:"";position:absolute;inset:6.4% 15.2% 4% 15.2%;border-radius:50% 50% 0 0/23% 23% 0 0;
  background:linear-gradient(180deg,rgba(8,6,26,0) 55%,rgba(8,6,26,.5)),url(./media/moonfold-hero.webp) 70% 50%/cover no-repeat,var(--ac-navy);
  box-shadow:0 24px 50px rgba(4,2,14,.55)}
body[data-page="register"] .art::before{background:linear-gradient(180deg,rgba(8,6,26,0) 60%,rgba(8,6,26,.45)),url(./media/cbt-invitation.webp) 50% 46%/cover no-repeat,var(--ac-navy)}
.art::after{content:"";position:absolute;inset:0;background:url(/assets/ui/gilt/frame.webp) center/100% 100% no-repeat;filter:drop-shadow(0 1px 0 rgba(6,4,18,.72)) drop-shadow(0 14px 22px rgba(4,2,14,.4))}

/* the letter: dark dusk panel, double gilt hairline, diamond nodes at the apex and foot */
.sheet{position:relative;z-index:1;align-self:center;padding:clamp(2.2rem,4vw,3.4rem) clamp(1.4rem,4vw,3.4rem) clamp(1.8rem,3.4vw,2.8rem) calc(clamp(1.4rem,4vw,3.4rem) + 34px);
  border-radius:18px;border:1px solid rgba(233,201,124,.62);
  background:radial-gradient(90% 60% at 100% 0%,rgba(184,174,230,.14),transparent 70%),linear-gradient(180deg,rgba(23,18,52,.94),rgba(10,8,28,.96));
  box-shadow:0 1px 0 rgba(6,4,18,.72),0 30px 70px rgba(4,2,14,.55)}
.sheet::before{content:"";position:absolute;inset:7px;border:1px solid rgba(233,201,124,.24);border-radius:12px;pointer-events:none}
.sheet::after{content:"";position:absolute;left:0;right:0;top:-8px;bottom:-8px;pointer-events:none;
  background:var(--ac-node) 50% 0/16px 16px no-repeat,var(--ac-node) 50% 100%/16px 16px no-repeat}
.back{display:inline-flex;align-items:center;min-height:40px;font-size:.9rem;color:var(--ac-tx-2);text-decoration:none}
.back:hover{color:var(--ac-tx);text-decoration:underline;text-underline-offset:.3em}
.sheet h1{margin:.5rem 0 0;font:700 clamp(2rem,1.4rem + 2.4vw,3.1rem)/1.2 Pridi,"Leelawadee UI",serif;letter-spacing:0;color:var(--ac-tx);text-wrap:balance;text-shadow:0 2px 16px rgba(8,6,26,.6)}
/* the compass seal breaking the letter's top-right corner (h1 is unpositioned, so this anchors to .sheet) */
.sheet h1::before{content:"";position:absolute;top:-38px;right:clamp(14px,3vw,34px);width:clamp(68px,8vw,92px);aspect-ratio:287/300;
  background:url(/assets/ui/gilt/medal-compass.webp) center/contain no-repeat;rotate:-8deg;filter:drop-shadow(0 1px 0 rgba(6,4,18,.72)) drop-shadow(0 10px 14px rgba(4,2,14,.5));pointer-events:none}
.intro{margin:1rem 0 0;color:var(--ac-tx-2);line-height:1.75;max-width:34rem}
.intro::before{content:"";display:block;width:min(240px,70%);height:16px;margin-bottom:.9rem;
  background:var(--ac-node) 0 50%/12px 12px no-repeat,linear-gradient(90deg,var(--ac-gilt),rgba(233,201,124,.55) 40%,transparent) 14px 50%/calc(100% - 14px) 1px no-repeat}

/* the RSVP stub: perforated gilt edge, then the account state that portal-account.js renders */
#account{position:relative;margin-top:1.5rem;padding-top:1.4rem;border-top:0;line-height:1.7;color:var(--ac-tx-2)}
#account::before{content:"";position:absolute;left:0;right:0;top:0;height:1px;background:repeating-linear-gradient(90deg,rgba(233,201,124,.55) 0 6px,transparent 6px 11px)}
#account p{margin:.3rem 0 1rem}
#account h2{margin:0 0 .35rem;font:600 1.15rem/1.4 Anuphan,"Leelawadee UI",sans-serif;color:var(--ac-tx)}
#account h2.success{display:flex;align-items:center;gap:.6rem;color:#8fe6d8}
#account h2.success::before{content:"";flex:none;width:12px;height:12px;rotate:45deg;background:linear-gradient(135deg,var(--ac-gilt-hi),var(--ac-gilt) 50%,var(--ac-gilt-lo));box-shadow:0 0 12px rgba(233,201,124,.55)}
.small,.muted{color:var(--ac-tx-3);font-size:.9rem}
#account .small{margin-top:0}

/* buttons: cream paper primary with a gold-ink inner hairline + chevrons (ref "start" plate); dusk ghost pill for the rest */
.actions{display:grid;gap:.7rem;margin-top:.4rem}
.sheet #account>.actions+.action{margin-top:.7rem}
.action{position:relative;display:flex;align-items:center;justify-content:center;width:100%;min-height:52px;padding:.65rem 3rem;border:0;border-radius:999px;
  font:600 1.02rem/1.35 Anuphan,"Leelawadee UI",sans-serif;text-align:center;text-decoration:none;cursor:pointer;color:var(--ac-navy);
  background:linear-gradient(180deg,#fdf5e2,var(--ac-cream) 45%,var(--ac-cream-2));
  box-shadow:0 2px 0 var(--ac-cream-edge),0 3px 0 rgba(6,4,18,.7),0 12px 24px rgba(4,2,14,.45);
  transition:transform .12s var(--ac-e-ui),filter .2s,box-shadow .2s}
.action::before{content:"";position:absolute;inset:4px;border-radius:inherit;border:1px solid rgba(160,122,46,.6);pointer-events:none}
.action::after{content:"";position:absolute;right:20px;top:50%;width:18px;height:12px;translate:0 -50%;pointer-events:none;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12' viewBox='0 0 18 12' fill='none' stroke='%231d2140' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 1.5 6.5 6 2 10.5M9.5 1.5 14 6l-4.5 4.5'/%3E%3C/svg%3E") center/contain no-repeat}
.action:hover{filter:brightness(1.04);transform:translateY(-1px)}
.action:active{transform:translateY(1px);box-shadow:0 1px 0 var(--ac-cream-edge),0 2px 0 rgba(6,4,18,.7),0 6px 14px rgba(4,2,14,.4)}
.action.secondary{color:var(--ac-tx);background:rgba(8,6,26,.42);box-shadow:inset 0 0 0 1px rgba(255,255,255,.42)}
.action.secondary::before,.action.secondary::after{display:none}
.action.secondary:hover{filter:none;background:rgba(255,255,255,.08);box-shadow:inset 0 0 0 1px rgba(255,255,255,.85)}
.action.secondary:active{box-shadow:inset 0 0 0 1px rgba(255,255,255,.85)}
.action:disabled{opacity:.55;cursor:wait;transform:none;filter:none}

details{margin-top:1.2rem;padding-top:1rem;border-top:1px solid rgba(221,215,242,.16)}
summary{display:flex;align-items:center;gap:.6rem;min-height:44px;cursor:pointer;list-style:none;color:var(--ac-tx);font-weight:500;text-decoration:underline;text-decoration-color:rgba(233,201,124,.7);text-underline-offset:.3em}
summary::-webkit-details-marker{display:none}
summary::before{content:"";flex:none;width:7px;height:7px;border-right:1.5px solid var(--ac-gilt);border-bottom:1.5px solid var(--ac-gilt);rotate:-45deg;transition:rotate .25s var(--ac-e-ui)}
details[open]>summary::before{rotate:45deg}
details .actions{margin-top:.7rem}
#feedback{margin:1rem 0 0;line-height:1.6;color:#ffc2b4}
#feedback:empty{display:none}
noscript{display:block;margin-top:1rem;color:var(--ac-tx-2)}

/* ---------------------------------------------------------------- phone: the frame becomes an arched banner with pop-up pieces */
@media (max-width:760px){
  .mast{flex-wrap:wrap;gap:.2rem 1rem;padding:.9rem 1rem}
  .mast::after{left:1rem;right:1rem}
  .mast nav{font-size:.88rem;gap:0 .7rem}
  .mast nav a+a::before{margin-right:.7rem}
  main{align-items:start;padding:1.6rem 1rem 2rem}
  .folio{grid-template-columns:1fr}
  .art{justify-self:stretch;max-width:none;aspect-ratio:auto;height:clamp(172px,54vw,280px);margin:0 6px -18px}
  .art::before{inset:0;border-radius:50% 50% 14px 14px/34% 34% 14px 14px;border:1px solid rgba(233,201,124,.8);outline:1px solid rgba(233,201,124,.32);outline-offset:4px;
    background-position:center,70% 42%,0 0}
  body[data-page="register"] .art::before{background-position:center,50% 44%,0 0}
  .art::after{inset:auto -6px -14px -6px;height:calc(100% + 34px);filter:drop-shadow(0 1px 0 rgba(6,4,18,.72)) drop-shadow(0 8px 12px rgba(4,2,14,.45));
    background:url(/assets/ui/gilt/wave.webp) left 0 bottom 0/clamp(92px,28vw,132px) auto no-repeat,
      url(/assets/ui/gilt/cloud-b.webp) right 2px bottom 6px/clamp(80px,24vw,118px) auto no-repeat,
      url(/assets/ui/gilt/crane.webp) right 9% top 0/clamp(58px,17vw,84px) auto no-repeat,
      url(/assets/ui/gilt/moon.webp) left 11% top 18px/clamp(26px,8vw,38px) auto no-repeat}
  .sheet{padding:2.6rem 1.25rem 1.6rem;border-radius:16px}
  .sheet h1{margin-top:.2rem;font-size:clamp(1.8rem,1.2rem + 3vw,2.3rem)}
  .sheet h1::before{top:22px;right:14px;width:54px}
  .back{font-size:.86rem}
  .action{padding-inline:2.4rem;font-size:1rem}
  .action::after{right:16px;width:15px}
  footer{padding:1rem 1rem 1.6rem;font-size:.84rem}
}
@media (max-width:360px){
  .mast nav{gap:0 .55rem}.mast nav a+a::before{margin-right:.55rem}
  .sheet{padding-inline:1rem}
  .action{padding-inline:2rem}
}

/* ---------------------------------------------------------------- motion: frame first, letter wipes in along the reading direction, seal folds up last */
@media (prefers-reduced-motion:no-preference){
  .art{animation:ac-rise .52s var(--ac-e-out) both}
  .sheet{animation:ac-wipe .52s var(--ac-e-draw) .12s both}
  .sheet h1::before{animation:ac-seal .6s var(--ac-e-fold) .5s both}
  #account>*{animation:ac-row .36s var(--ac-e-out) both}
  #account>*:nth-child(2){animation-delay:.06s}#account>*:nth-child(3){animation-delay:.12s}#account>*:nth-child(4){animation-delay:.18s}#account>*:nth-child(n+5){animation-delay:.24s}
}
@keyframes ac-rise{from{opacity:0;transform:translateY(14px)}}
@keyframes ac-wipe{from{clip-path:inset(-60px 100% -60px -60px)}to{clip-path:inset(-60px -60px -60px -60px)}}
@keyframes ac-seal{from{opacity:0;transform:scale(.55) rotate(-24deg)}}
@keyframes ac-row{from{opacity:0;transform:translateY(8px)}}
