/* Loading outlines from src/skeleton.js: they appear after 0.3 s, so a quick load never flashes,
   and the grey shapes pulse slowly until the real content replaces them. */
.skeleton {
  animation: skeleton-appear 0.2s ease-out 0.3s both;
}

/* The shapes' wrapper fills a skeleton that is given a height (a slide, a cover). */
.skeleton > [aria-hidden="true"] { height: 100%; }

.skeleton-bar,
.skeleton-dot,
.skeleton-block {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line), var(--muted) 20%);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton-bar.skeleton-strong { height: 12px; }
.skeleton-bar.skeleton-big { height: 18px; }
.skeleton-bar.skeleton-title { height: 30px; border-radius: 12px; }

.skeleton-dot {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.skeleton-dot.is-big {
  width: 64px;
  height: 64px;
}

.skeleton-block {
  height: 52px;
  border-radius: 14px;
}

.skeleton-heading {
  display: grid;
  gap: 12px;
  margin-bottom: 28px;
}

.skeleton-table,
.skeleton-list,
.skeleton-stack {
  display: grid;
  gap: 14px;
}

.skeleton-stack { gap: 20px; }

.skeleton-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 18px;
  align-items: center;
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
}

.skeleton-row.is-head .skeleton-bar { height: 8px; }

.skeleton-item {
  display: flex;
  gap: 12px;
  align-items: center;
}

.skeleton-lines {
  display: grid;
  flex: 1;
  gap: 8px;
}

.skeleton-card,
.skeleton-tile,
.skeleton-day {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.skeleton-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.skeleton-cards .skeleton-block { height: 110px; }

.skeleton-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.skeleton-week {
  display: grid;
  grid-template-columns: repeat(var(--days, 7), minmax(0, 1fr));
  gap: 10px;
}

.skeleton-day { padding: 12px; gap: 10px; }

.skeleton-slide,
.skeleton-slide .skeleton-block {
  width: 100%;
  height: 100%;
}

.skeleton-slide .skeleton-block { min-height: 120px; border-radius: 12px; }

.skeleton-card > .skeleton-block { height: 140px; }

.skeleton-cover {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.skeleton-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.skeleton-thumbs .skeleton-block { height: auto; aspect-ratio: 1; }

/* A loading box that fills a frame (presentation, resource, booklet page). */
.class-presentation-message:has(> .skeleton),
.teacher-booklet-loading:has(> .skeleton),
.media-loading-state:has(> .skeleton) {
  place-items: stretch;
  align-content: stretch;
  padding: 16px;
}

.class-presentation-message .skeleton,
.teacher-booklet-loading .skeleton,
.media-loading-state .skeleton,
.teacher-booklet-cover-loading .skeleton {
  width: 100%;
  height: 100%;
}

/* On the dark presentation and booklet stages the shapes are light. */
.class-presentation-message .skeleton-block,
.teacher-booklet-loading .skeleton-block {
  background: rgba(255, 255, 255, 0.14);
}

.teens-slide > .skeleton { padding: 30px 34px; }

/* The white card the assignment panels load in. */
.assignment-loading:has(> .skeleton) { justify-items: stretch; text-align: left; }

/* A shape that stands in for a grid's items spans the whole grid. */
.sb-grid > .skeleton,
.bd-own-grid > .skeleton {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .skeleton-row { grid-template-columns: 2fr 1fr; }
  .skeleton-row .skeleton-bar:nth-child(n + 3) { display: none; }
  .skeleton-week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skeleton-week .skeleton-day:nth-child(n + 5) { display: none; }
}

@keyframes skeleton-appear {
  from { opacity: 0; }
}

@keyframes skeleton-pulse {
  50% { opacity: 0.45; }
}

/* Still shapes, no fade or pulse: they only wait the same 0.3 s before showing. */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation-duration: 0.01s; }

  .skeleton-bar,
  .skeleton-dot,
  .skeleton-block {
    animation: none;
  }
}
