body {
  margin: 0;
}

html {
  overflow-x: hidden;
  overflow-y: scroll;
}

/* First-load screen (index.html), shown until Vue mounts */
#loading-bg {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--initial-loader-bg, transparent);
  block-size: 100%;
  gap: 1rem 0;
  inline-size: 100%;
}

/*
 * Logo loading animation for the DCH shield logo.
 * Shared by index.html and src/components/feedback/Loading.vue.
 * Every layer is one part of the logo, cut from the original SVG into its own
 * file with the same 4597x5161 canvas (public/logo/dch/parts/*.svg), so the
 * layers stack exactly. Logos without parts use .logo-pulse.
 *
 * The build-up plays ONCE, then the logo stays and idles (no restart):
 *   0-0.35s    shield pops in
 *   0.25-0.75s D, C, H fade in from a blur, top to bottom
 *   0.45-0.75s book opens from its spine
 *   0.6-1.2s   two pages turn from right to left
 *   0.75-1.2s  graduation cap drops onto the book with a small bounce
 *   1.2s+      idle: cap floats gently, shine sweeps the shield every 2.4s
 *
 * Markup: .logo-anim (with --logo: url(logo.svg)) containing
 *   img.la-part.la-shield, 3x img.la-part.la-letter (animation-delay),
 *   img.la-part.la-book, 2x img.la-part.la-page (animation-delay + --page-opacity),
 *   span.la-shine, img.la-part.la-cap
 */
.logo-anim {
  position: relative;
  aspect-ratio: 4597 / 5161;
  inline-size: 120px;
  perspective: 600px;
}

.logo-anim .la-part {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  will-change: transform, opacity;
}

/* 1) Shield: pops in from the centre */
.logo-anim .la-shield {
  transform-origin: 50% 50%;
  animation: la-shield-in 0.35s ease-out both;
}
@keyframes la-shield-in {
  0%   { opacity: 0; transform: scale(0.7); }
  60%  { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: none; }
}

/* 2) Letters: fade in from a blur, D then C then H (delays set inline) */
.logo-anim .la-letter {
  animation: la-letter 0.35s ease-out both;
}
@keyframes la-letter {
  0%   { opacity: 0; transform: translateX(-6%); filter: blur(6px); }
  50%  { opacity: 0.5; filter: blur(3px); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}

/* 3) Book: opens out from its spine */
.logo-anim .la-book {
  transform-origin: 70.1% 46.6%;
  animation: la-book-open 0.3s ease-out 0.45s both;
}
@keyframes la-book-open {
  0%   { opacity: 0; transform: scaleX(0) scaleY(0.6); }
  60%  { opacity: 1; transform: scaleX(1.06) scaleY(1.04); }
  100% { opacity: 1; transform: none; }
}

/* 4) Pages: the right-hand leaf flips over the spine to the left (3D turn).
 *    Only 0% and 100% set the transform, so there is no pause mid-turn. */
.logo-anim .la-page {
  clip-path: inset(0 0 0 70.1%);
  transform-origin: 70.1% 46.6%;
  animation-name: la-page-turn;
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.45, 0.05, 0.25, 1);
  animation-fill-mode: both;
}
@keyframes la-page-turn {
  0%   { opacity: 0; transform: rotateY(0deg); }
  15%  { opacity: var(--page-opacity, 0.7); }
  70%  { opacity: var(--page-opacity, 0.7); }
  100% { opacity: 0; transform: rotateY(-180deg); }
}

/* 5) Cap: drops onto the book with a small bounce, then floats gently */
.logo-anim .la-cap {
  transform-origin: 70.1% 38%;
  animation:
    la-cap-drop 0.45s 0.75s both,
    la-cap-float 2.4s ease-in-out 1.2s infinite;
}
@keyframes la-cap-drop {
  0%   { opacity: 0; transform: translateY(-14%) rotate(-12deg); animation-timing-function: ease-in; }
  25%  { opacity: 1; }
  50%  { transform: translateY(0) rotate(0deg); animation-timing-function: ease-out; }
  70%  { transform: translateY(-3%) rotate(3deg); animation-timing-function: ease-in; }
  100% { opacity: 1; transform: translateY(0) rotate(0deg); }
}
@keyframes la-cap-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-2%) rotate(-3deg); }
}

/* 6) Shine: a light band sweeps across the shield, repeating while loading */
.logo-anim .la-shine {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 42%, rgba(255, 255, 255, 0.6) 50%, transparent 58%);
  background-size: 300% 100%;
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
  animation: la-shine 2.4s linear 1.2s infinite;
}
@keyframes la-shine {
  0%   { opacity: 1; background-position: 100% 0; }
  25%  { opacity: 1; background-position: 0% 0; }
  26%  { opacity: 0; }
  100% { opacity: 0; background-position: 0% 0; }
}

/* Fallback for logos without parts: gentle pulse */
.logo-pulse {
  height: auto;
  object-fit: contain;
  animation: la-pulse 1.6s ease-in-out infinite;
}
@keyframes la-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.94); }
  50%      { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .logo-anim .la-part, .logo-pulse { animation: none; }
  .logo-anim .la-page, .logo-anim .la-shine { display: none; }
}
