/* Packs: the cards on the homepage (js/features/packs-grid.js). A pack is 10 wallpapers
   around one mood; a click opens its pop-up (css/pack-modal.css). */

/* ---------- Homepage section ---------- */

.packs {
  max-width: calc(920px + 2 * var(--gutter)); /* a row of 920 px: three cards of about 290 px */
  margin-inline: auto;
  padding: 88px var(--gutter) 112px;
}

.packs-header {
  max-width: 560px;
  margin-bottom: 40px;
}

/* .packs-title, .bundles-title: the look comes from .spaced-title (css/base.css). */

/* The filter above the packs: words in small spaced capitals on a fine line, with a ice-blue line
   that slides under the chosen one (.pack-filter-indicator, js/features/pack-filter.js).
   On a phone the row scrolls sideways. */
.pack-filter {
  position: relative;
  display: flex;
  gap: 28px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--color-line);
  overflow-x: auto;
  scrollbar-width: none;
}

.pack-filter[hidden] {
  display: none;
}

.pack-filter-chip {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 0 12px;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 250ms var(--ease-in-out);
}

.pack-filter-chip:hover,
.pack-filter-chip[aria-pressed="true"] {
  color: var(--color-text);
}

.pack-filter-count {
  color: var(--color-text-muted);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.pack-filter-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  background: var(--color-accent);
  transform-origin: left;
  transition: transform 450ms var(--ease-out);
}

.packs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 36px 28px;
  list-style: none;
}

.bundles-title {
  margin-bottom: 28px;
}

.packs-empty {
  color: var(--color-text-muted);
  font-size: 15px;
}

/* ---------- One card ---------- */

.pack-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* A square panel with the monitor small in the middle, so every card has room to breathe. */
.pack-card-panel {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 28px;
  overflow: hidden; /* keeps the monitor's coloured glow inside the panel */
  border-radius: var(--radius-frame);
  background: var(--color-frame);
  transition: background-color 250ms var(--ease-in-out);
}

.pack-card:hover .pack-card-panel {
  background: var(--color-pill);
}

.pack-card-device {
  width: 72%; /* about 190 px in a 290 px card: room around the screen */
  transition: transform 250ms var(--ease-in-out);
}

.pack-card:hover .pack-card-device {
  transform: translateY(-4px);
}

/* The dots under the screen while a card plays its pack on hover (js/features/card-preview.js). */
.card-preview-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  display: flex;
  gap: 5px;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 250ms var(--ease-in-out);
}

.is-previewing .card-preview-dots {
  opacity: 1;
}

.card-preview-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-text-muted);
  opacity: 0.45;
  transition:
    opacity 250ms var(--ease-in-out),
    background-color 250ms var(--ease-in-out);
}

.card-preview-dots span.is-on {
  background: var(--color-accent);
  opacity: 1;
}

/* "10 wallpapers · €7" in the top right corner of the panel. */
.pack-card-label {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 5px 12px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-background);
  color: var(--color-text-soft);
  font-size: 13px;
  font-weight: 500;
}

/* The name in spaced capitals: .spaced-title-small (css/base.css). */
.pack-card-title {
  padding-inline: 4px;
}

/* Only on localhost: a pack that is not complete, so not on the real site yet. */
.pack-card-draft {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-note-background);
  color: var(--color-note);
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Grey card while the packs load. */
.pack-card-placeholder-screen {
  aspect-ratio: 1;
  border-radius: var(--radius-frame);
}

.pack-card-placeholder-line {
  height: 18px;
  width: 60%;
  border-radius: 6px;
}

.pack-card-placeholder-line-short {
  width: 35%;
}

/* ---------- Bundles: the cards under the packs ---------- */

.bundles {
  margin-top: 88px;
  scroll-margin-top: 80px; /* the "#bundles" link stops below the top bar */
}

.bundle-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: 24px;
  list-style: none;
}

/* On hover the card lifts a little, its edge and a soft glow take the accent colour, and the
   stack of MacBooks fans out (below). */
.bundle-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-frame);
  transition:
    transform 600ms var(--ease-out),
    border-color 400ms var(--ease-in-out),
    box-shadow 600ms var(--ease-out);
}

.bundle-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(120% 80% at 30% 20%, color-mix(in oklch, var(--color-accent) 8%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 500ms var(--ease-in-out);
}

.bundle-card:hover,
.bundle-card:focus-within {
  border-color: color-mix(in oklch, var(--color-accent) 40%, transparent);
  box-shadow: 0 24px 60px -24px color-mix(in oklch, var(--color-accent) 25%, transparent);
  transform: translateY(-3px);
}

.bundle-card:hover::before,
.bundle-card:focus-within::before {
  opacity: 1;
}

/* Up to three MacBooks with pack covers, stacked from top left to bottom right like a pack of
   cards: each one is 40% of the width and moves 30% (three quarters of itself) right and down,
   so neighbours overlap a quarter. The height just holds the three steps (about 1 : 0.56). */
.bundle-card-covers {
  position: relative;
  display: block;
  aspect-ratio: 100 / 56;
}

.bundle-card-device {
  position: absolute;
  top: calc(var(--stack-index) * 19%);
  left: calc(var(--stack-index) * 30%);
  z-index: calc(var(--stack-index) + 1);
  width: 40%;
  filter: drop-shadow(0 12px 18px rgb(0 0 0 / 0.35));
  transition: transform 700ms var(--ease-out);
}

/* The fan: the first MacBook tips back and to the left, the middle one rises, the last one
   tips forward and to the right, like a pack of cards spread in the hand. */
.bundle-card:hover .bundle-card-device:nth-child(1),
.bundle-card:focus-within .bundle-card-device:nth-child(1) {
  transform: translate(-9%, -6%) rotate(-7deg);
}

.bundle-card:hover .bundle-card-device:nth-child(2),
.bundle-card:focus-within .bundle-card-device:nth-child(2) {
  transform: translateY(-8%) scale(1.05);
}

.bundle-card:hover .bundle-card-device:nth-child(3),
.bundle-card:focus-within .bundle-card-device:nth-child(3) {
  transform: translate(9%, 4%) rotate(7deg);
}

/* The name: .spaced-title-small (css/base.css). */

.bundle-card-packs {
  margin-top: 6px;
  color: var(--color-text-soft);
  font-size: 14px;
}

.bundle-card-price {
  margin-top: 14px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.bundle-card-price strong {
  margin-right: 6px;
  color: var(--color-text);
  font-size: 22px;
  font-weight: 600;
}

.bundle-card-buy {
  width: 100%;
  margin-top: 16px;
  padding: 13px 20px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-button);
  color: var(--color-button-text);
  font: inherit;
  cursor: pointer;
  /* premium look: small spaced capitals */
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
