/* Shared mobile viewer behavior for all Birthday templates.
   Keep template-specific artwork and movement intact. */
html:has(#birthday-invitation.paw-approved),
html:has(#birthday-invitation.frozen-approved){
  scrollbar-gutter:auto;
  overflow-x:clip;
}
body:has(#birthday-invitation.paw-approved),
body:has(#birthday-invitation.frozen-approved){
  margin:0;
  padding:0;
  width:100%;
  overflow-x:clip;
}
/* The player itself supplies the white bezel. Do not add internal gutters. */
#birthday-invitation.paw-approved,
#birthday-invitation.frozen-approved{
  box-sizing:border-box;
  display:block;
  width:100%;
  max-width:440px;
  margin-inline:auto;
  padding:0;
  border:0;
}
#birthday-invitation.paw-approved > .cover,
#birthday-invitation.frozen-approved > .cover,
#birthday-invitation.paw-approved > #invitation,
#birthday-invitation.frozen-approved > #invitation{
  box-sizing:border-box;
  width:100%;
  max-width:100%;
  margin-inline:0;
  padding-inline:0;
}
#birthday-invitation.paw-approved .cover,
#birthday-invitation.paw-approved .scene,
#birthday-invitation.frozen-approved .cover,
#birthday-invitation.frozen-approved .scene{
  width:100%;
  max-width:100%;
  margin:0;
  height:100svh;
  height:100dvh;
  overflow:hidden;
}
#birthday-invitation.paw-approved .cover > :is(img,video),
#birthday-invitation.paw-approved .scene > :is(img,video),
#birthday-invitation.frozen-approved .cover > :is(img,video),
#birthday-invitation.frozen-approved .scene > :is(img,video){
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}
@media (max-width:440px){
  #birthday-invitation.paw-approved,
  #birthday-invitation.frozen-approved{width:100%;max-width:none}
}
/* Prevent pre-opening scrolling without changing any visible UI. */
html:has(body.birthday-viewer-closed),body.birthday-viewer-closed{overflow:hidden;overscroll-behavior:none}

/* Birthday uses the same desktop phone canvas as Wedding.
   Media fills the scene directly; never render a second copy of artwork
   as a background. A small, centered horizontal crop is inherent when a
   9:16 video covers Wedding's taller phone ratio. */
:root{--birthday-public-phone-width:var(--bulawa-viewer-width, 440px)}
@media(min-width:768px){
  html:has(#birthday-invitation){background:#262923}
  body:has(#birthday-invitation){
    background:#262923;
    min-height:100dvh;
    overflow:hidden;
  }
  body > #birthday-invitation{
    box-sizing:border-box;
    position:fixed;
    inset:0;
    width:min(100vw,var(--birthday-public-phone-width));
    max-width:var(--birthday-public-phone-width);
    height:min(var(--bulawa-viewer-height, 900px),100dvh);
    max-height:100dvh;
    min-height:0;
    margin:auto;
    padding:0;
    border:0;
    border-radius:0;
    box-shadow:none;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior:contain;
    scroll-behavior:smooth;
    scrollbar-width:none;
    background:transparent;
  }
  body > #birthday-invitation::-webkit-scrollbar{display:none;width:0;height:0}
  body.birthday-viewer-closed > #birthday-invitation{overflow:hidden}

  /* Opening artwork follows the actual desktop phone height, not a 9:16
     container or a template-specific 100dvh height. */
  body > #birthday-invitation:is(.paw-approved,.frozen-approved) :is(.cover,.scene){
    box-sizing:border-box;
    position:relative;
    width:100%!important;
    max-width:100%!important;
    height:min(var(--bulawa-viewer-height, 900px),100dvh)!important;
    min-height:0!important;
    max-height:100dvh!important;
    aspect-ratio:auto!important;
    margin:0!important;
    border-radius:0!important;
    overflow:hidden;
  }
  /* Fill the entire tall phone frame with the actual video/image.
     Do not distort and do not place any duplicate artwork behind it. */
  body > #birthday-invitation:is(.paw-approved,.frozen-approved) :is(.cover,.scene) > :is(img,video){
    width:100%!important;
    height:100%!important;
    object-fit:cover!important;
    object-position:50% 50%;
    border-radius:0!important;
  }
  /* The music control and Frozen effects remain aligned to the centered
     phone canvas, including when the browser is taller than var(--bulawa-viewer-height, 900px). */
  body > #birthday-invitation:is(.paw-approved,.frozen-approved) .music-button{
    position:fixed;
    right:max(12px,calc((100vw - min(100vw,var(--birthday-public-phone-width))) / 2 + 12px));
    bottom:max(12px,calc((100dvh - var(--bulawa-viewer-height, 900px)) / 2 + 12px));
  }
  body > #birthday-invitation.frozen-approved .snow,
  body > .snow{
    top:max(0px,calc((100dvh - var(--bulawa-viewer-height, 900px)) / 2));
    height:min(var(--bulawa-viewer-height, 900px),100dvh);
    max-height:100dvh;
  }
}
@media(max-width:767px){
  body > #birthday-invitation{
    position:relative;
    width:100%;
    max-width:440px;
    height:auto;
    min-height:100dvh;
    overflow:visible;
    margin-inline:auto;
  }
}

/* Invitation-specific farewell wording is live HTML, separate from artwork. */
#birthday-invitation .birthday-farewell-message{display:block;position:relative;z-index:3;margin:8px auto 14px;max-width:32ch;padding:0 12px;font:italic 700 clamp(16px,4cqw,22px)/1.35 Georgia,serif;text-align:center;overflow-wrap:anywhere;color:#275f7d}
