/*
 * Shared base of every sample (copied by sources/build.mjs — edit it here): reset, the two floating buttons (music and
 * language), the appear-on-scroll movement. Each sample sets its colours and fonts through these variables:
 *   --bg, --ink, --accent, --btn-bg, --btn-ink, --font-text, --font-text-ar
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html[dir='rtl'] body {
  font-family: var(--font-text-ar);
}
img {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
/* Until the invitation is opened, only the opening shows and the page does not scroll. */
html:not([data-opened]) body {
  overflow: hidden;
  height: 100svh;
}

/* ——— The two floating buttons ——— */
.inv-controls {
  position: fixed;
  z-index: 60;
  inset-inline-end: max(14px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  justify-items: center;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.8s ease 0.6s,
    transform 0.8s ease 0.6s;
  pointer-events: none;
}
html[data-opened] .inv-controls {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.inv-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.5);
  -webkit-tap-highlight-color: transparent;
}
.inv-lang {
  width: auto;
  height: 38px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.inv-lang [lang='ar'],
.inv-lang:lang(ar) {
  font-family: var(--font-text-ar);
}
/* Music: three bars that move while it plays, a still note when paused. */
.inv-eq {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}
.inv-eq i {
  width: 3px;
  height: 30%;
  border-radius: 2px;
  background: currentColor;
  transition: height 0.3s ease;
}
html[data-music='on'] .inv-eq i {
  animation: inv-eq 0.9s ease-in-out infinite alternate;
}
html[data-music='on'] .inv-eq i:nth-child(2) {
  animation-delay: -0.3s;
}
html[data-music='on'] .inv-eq i:nth-child(3) {
  animation-delay: -0.6s;
}
@keyframes inv-eq {
  from {
    height: 25%;
  }
  to {
    height: 100%;
  }
}

/* ——— Appear on scroll ——— */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 1.1s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--d, 0) * 1s);
}
[data-reveal].in {
  opacity: 1;
  transform: none;
}

[data-numdate] {
  unicode-bidi: isolate;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
