/* Side Quests overlay (js/modules/folder.js): the folder's middle paper becomes this full-screen sheet.
   .is-open  -> page behind dims (while the sheet flies)
   .is-ready -> sheet's pattern fades back, header and cards rise in */
.sq-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.sq-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 27, 25, 0.35);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.sq-overlay.is-open .sq-backdrop { opacity: 1; }

/* The flying paper: same color and pattern as .paper-3. --u is one folder unit in px (set by JS),
   so the pattern lines up with the paper at the start and stays the same size as it grows */
.sq-sheet {
  --u: 5px;
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  background-color: #fbe8e3;
  box-shadow: 0 12px 40px rgba(10, 30, 60, 0.25);
  will-change: left, top, width, height;
}
.sq-sheet.is-full {
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
}
.sq-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../../assets/images/patterns/pattern-3.svg") calc(var(--u) * -9) calc(var(--u) * -2) / calc(var(--u) * 34) calc(var(--u) * 34);
  transition: opacity 0.6s ease;
}
.sq-overlay.is-ready .sq-sheet::before { opacity: 0.12; }

/* Content: header + one row of cards, on top of the sheet */
.sq-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: none;
}
.sq-overlay.is-ready .sq-content { pointer-events: auto; }

/* Header sits exactly where the page header is, so the "uxfaisal." wordmark appears in the same spot (in ink) */
.sq-header > * {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sq-overlay.is-ready .sq-header > * { opacity: 1; transform: none; }
.sq-wordmark { color: var(--color-ink); }
.sq-close {
  border: 0;
  background: none;
  color: var(--color-ink);
  cursor: pointer;
}
.sq-close:focus-visible { outline-color: var(--color-ink); }

/* One row of cards, centred in the space under the header and scrolled sideways
   (mouse wheel too, js/modules/wheel-scroll.js) */
.sq-grid {
  display: flex;
  gap: var(--card-gap);
  margin: auto 0;
  padding: 1rem var(--gutter) var(--gutter);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}
.sq-grid::-webkit-scrollbar { display: none; }

.sq-item {
  flex: 0 0 clamp(240px, 23vw, 340px);
  scroll-snap-align: start;
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.sq-overlay.is-ready .sq-item {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: calc(0.15s + var(--i) * 0.06s);
}

.sq-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0.6rem 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--color-white);
  box-shadow: 0 1px 2px rgba(28, 27, 25, 0.06), 0 8px 24px rgba(28, 27, 25, 0.08);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}
a.sq-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(28, 27, 25, 0.08), 0 18px 36px rgba(28, 27, 25, 0.14);
}
a.sq-card:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 3px; }

.sq-card-media {
  aspect-ratio: 4 / 3;
  border-radius: calc(var(--radius) - 0.6rem);
  overflow: hidden;
}
.sq-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sq-card-title {
  margin: 0.85rem 0.4rem 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
/* The short line under the title, split on · into pills */
.sq-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.55rem 0.4rem 0;
  padding: 0;
  list-style: none;
}
.sq-card-pills:empty { display: none; }
.sq-card-pills li {
  padding: 0.25rem 0.65rem;
  border: 1px solid rgba(28, 27, 25, 0.15);
  border-radius: 999px;
  color: rgba(28, 27, 25, 0.7);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

/* Opening a side quest: its card grows into a full-screen layer in its picture colour (js/modules/folder.js) */
.sq-expand {
  position: fixed;
  z-index: 200;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Phones: smaller cards */
@media (max-width: 640px) {
  .sq-item { flex-basis: min(75vw, 280px); }
}

@media (prefers-reduced-motion: reduce) {
  .sq-backdrop,
  .sq-sheet::before,
  .sq-header > *,
  .sq-item,
  .sq-overlay.is-ready .sq-item { transition: none; }
}
