/* ==========================================================================
   Skeleton loading

   WHAT THIS SITE ACTUALLY LOADS ASYNCHRONOUSLY. Every page here is rendered
   by Blade: the controller fetches the CMS and ships finished HTML, so by the
   time the browser has a page the data is already in it and a skeleton would
   have nothing to stand in for. Two surfaces are genuinely asynchronous —
   the news list (category filter, search, pagination) and the course tables
   on a college's syllabus page — and both replaced their contents with a bare
   spinner. These are the shapes that go in their place.

   The markup lives in Blade components under resources/views/components/
   skeleton/, rendered once per page into <template> elements that
   assets/js/skeleton.js clones. One definition, server-side, in the project's
   own idiom — no duplicate markup inside JavaScript strings.

   Tokens, radii and spacing are the site's own. Logical properties
   throughout, so the RTL (style.css) and LTR (en.css) shells are both
   covered; the shimmer is given its own direction so it always travels with
   the reading direction.
   ========================================================================== */

:root {
  --ul-sk-base: #e9ecef;
  --ul-sk-sheen: rgba(255, 255, 255, 0.65);
  --ul-sk-radius: 8px;
}

/* ──────────────────────────────────────────────────────────── the one block

   Everything below is this shape at a different size. A skeleton is a block
   with a background that moves; it has no text, no border and no content, so
   it is also hidden from assistive technology — the container announces the
   wait, not the forty grey rectangles inside it. */
.ul-sk {
  position: relative;
  overflow: hidden;
  display: block;
  background-color: var(--ul-sk-base);
  border-radius: var(--ul-sk-radius);
  /* Never collapse to nothing: a block with no height is invisible, and an
     invisible skeleton is a layout shift waiting to happen. */
  min-height: 12px;
}

/* The sheen is a pseudo-element rather than an animated background-position
   on the block itself: it composites on the GPU and does not repaint the
   block under it, so a page with sixty of them still idles at nothing. */
.ul-sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    var(--ul-sk-sheen) 50%,
    transparent 100%
  );
  animation: ul-sk-sheen 1.4s ease-in-out infinite;
}

/* Right to left, the sheen travels right to left. */
[dir="rtl"] .ul-sk::after {
  transform: translateX(100%);
  animation-name: ul-sk-sheen-rtl;
}

@keyframes ul-sk-sheen {
  100% { transform: translateX(100%); }
}

@keyframes ul-sk-sheen-rtl {
  100% { transform: translateX(-100%); }
}

/* ────────────────────────────────────────────────────────────────── shapes */

.ul-sk-text {
  height: 0.85em;
  margin-block: 0.32em;
  border-radius: 4px;
}

.ul-sk-text:last-child {
  margin-block-end: 0;
}

/* A paragraph does not end flush with the margin, and a skeleton that does
   reads as a block rather than as words. */
.ul-sk-text.is-last {
  width: 62%;
}

.ul-sk-title {
  height: 1.15em;
  margin-block: 0 0.5em;
  border-radius: 5px;
}

.ul-sk-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.ul-sk-thumb {
  width: 100%;
  /* The real card's image box, so swapping one for the other moves nothing. */
  aspect-ratio: 16 / 10;
  border-radius: 0;
}

.ul-sk-chip {
  height: 30px;
  width: 110px;
  border-radius: 999px;
}

.ul-sk-btn {
  height: 38px;
  width: 128px;
  border-radius: 9px;
}

/* ───────────────────────────────────────────────────────────── containers */

/* The container carries the announcement; see skeleton.js, which also sets
   aria-busy on the element whose contents are being replaced. */
.ul-sk-wrap {
  display: contents;
}

.ul-sk-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ─────────────────────────────────────────────────── the news card shape

   Mirrors .ul-blog — image box, title, two meta lines, a button — so the
   grid does not jump when the real cards arrive. */
.ul-sk-blog {
  overflow: hidden;
  border-radius: 12px;
  background: var(--white, #fff);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ul-sk-blog-body {
  padding: 18px 20px 20px;
}

.ul-sk-blog-meta {
  display: flex;
  gap: 16px;
  margin-top: 14px;
}

.ul-sk-blog-meta .ul-sk {
  height: 13px;
  width: 92px;
  border-radius: 4px;
}

/* ───────────────────────────────────────────── the course accordion shape */

.ul-sk-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ul-sk-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 28px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: var(--white, #fff);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ul-sk-row .ul-sk {
  height: 17px;
  width: min(42%, 260px);
  border-radius: 5px;
}

/* ─────────────────────────────────────────────── error and empty states

   The two surfaces printed a bare <p> for both, with no icon, no spacing and
   no way to try again. They share the site's own empty-state shape. */
.ul-sk-state {
  grid-column: 1 / -1;
  width: 100%;
  padding: clamp(28px, 4vw, 48px) 20px;
  text-align: center;
  color: var(--ul-gray2, #5D6063);
}

.ul-sk-state i {
  display: block;
  margin-bottom: 14px;
  font-size: 30px;
  color: var(--ul-gray3, #8a8f94);
}

.ul-sk-state p {
  margin: 0;
  font-size: clamp(14px, 0.95vw, 16px);
  line-height: 1.9;
}

.ul-sk-state .ul-sk-retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 20px;
  border: 1px solid rgba(11, 37, 78, 0.16);
  border-radius: 9px;
  background: var(--white, #fff);
  color: var(--ul-primary, #0b254e);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.ul-sk-state .ul-sk-retry:hover,
.ul-sk-state .ul-sk-retry:focus-visible {
  border-color: var(--ul-c3, #febe35);
}

/* ─────────────────────────────────────── refreshing content already shown

   Paging and filtering have something on screen already. Replacing it with a
   skeleton would be a step backwards, so it stays and dims instead, with
   pointer events off so nothing is clicked mid-swap.
   ────────────────────────────────────────────────────────────────────────── */
.ul-sk-busy {
  position: relative;
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

/* ───────────────────────────────────────────────────────────────── themes */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ul-sk-base: #2a2f36;
    --ul-sk-sheen: rgba(255, 255, 255, 0.08);
  }

  :root:not([data-theme="light"]) .ul-sk-blog,
  :root:not([data-theme="light"]) .ul-sk-row {
    background: #1d2228;
    border-color: #2a2f36;
    box-shadow: none;
  }
}

:root[data-theme="dark"] {
  --ul-sk-base: #2a2f36;
  --ul-sk-sheen: rgba(255, 255, 255, 0.08);
}

/* The sheen is decoration. Without it the blocks still mark out the shape of
   what is coming, which is the whole job. */
@media (prefers-reduced-motion: reduce) {
  .ul-sk::after {
    animation: none;
  }

  .ul-sk-busy {
    transition: none;
  }
}

/* ────────────────────────────────────────────── the faculty slider's shape

   The homepage's faculty band is filled after the page has loaded, because
   the roster endpoint answers with every member of the university and takes
   about five seconds to do it. These rules only neutralise the real card's
   hover and lift while it stands empty — the geometry comes from the card's
   own classes, so nothing shifts when the slides arrive. */

.ul-sk-faculty {
  box-shadow: none;
  pointer-events: none;
  transform: none;
}

.ul-sk-faculty::after {
  display: none;
}

/* The real photo circle: 120px, centred, with the card's own ring. */
.ul-sk-faculty-photo {
  width: 120px;
  height: 120px;
}

/* ───────────────────────────────────────────────────────────── responsive */

@media (max-width: 767px) {
  .ul-sk-row {
    padding: 14px 18px;
  }

  .ul-sk-blog-body {
    padding: 16px;
  }
}
