/* ═══════════════════════════════════════════════════════════════════════════
   MAVEA — LIBRARY ROWS, shared component.

   One category = a bold title, a one-line description, prev/next arrows on the
   right, and a horizontally scrollable rail of 9:16 tiles that preview muted on
   hover and toggle sound on click.

   Values here are lifted verbatim from the rows on sm-ad-videos.html so the two
   pages match exactly. Behaviour lives in js/library-rows.js.

   NOTE: sm-ad-videos.html still carries its own inline copy of these rules and
   its own builder (its rows are wired to the filter chips and the scroll-spy).
   This file + js/library-rows.js are the standalone version used by the service
   pages. Migrating sm-ad-videos.html onto them is a separate, larger change.
   ═══════════════════════════════════════════════════════════════════════════ */

.lib-row {
  margin-bottom: clamp(3.4rem, 7vw, 6rem);
  scroll-margin-top: calc(var(--nav-h, 80px) + 28px);
}

.lib-row__head {
  max-width: 1240px;
  margin: 0 auto clamp(1.1rem, 2.2vw, 1.5rem);
  padding-inline: clamp(1.5rem, 6vw, 4rem);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.lib-row__title {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.2vw, 2.125rem);   /* ~34px desktop */
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--dark);
}

.lib-row__desc {
  margin: 0;
  max-width: 62ch;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(0.9rem, 1.15vw, 1rem);
  line-height: 1.6;
  color: var(--grey);
}

.lib-row__nav { display: none; gap: 8px; flex: 0 0 auto; padding-bottom: 2px; }
@media (hover: hover) and (pointer: fine) { .lib-row__nav { display: flex; } }

/* ── The rail ──────────────────────────────────────────────────────────── */

.lib-strip-wrap { position: relative; }
.lib-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 6px clamp(1.5rem, 6vw, 4rem) 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
}
.lib-strip::-webkit-scrollbar { display: none; }
.lib-strip.is-dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; }

/* right-edge fade hinting there is more */
.lib-strip-wrap::after {
  content: '';
  position: absolute;
  top: 0; bottom: 16px; right: 0;
  width: clamp(30px, 5vw, 64px);
  background: linear-gradient(to right, rgba(252, 251, 250, 0), var(--cream));
  pointer-events: none;
}
/* a rail that already fits needs no controls and no fade */
.lib-row.is-static .lib-row__nav,
.lib-strip-wrap.is-static::after { display: none; }

/* ── Tiles ─────────────────────────────────────────────────────────────── */

.lib-tile {
  position: relative;
  flex: 0 0 clamp(150px, 21vw, 208px);
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  background: var(--dark);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  scroll-snap-align: start;
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.4s ease;
}
.lib-tile:hover { transform: translateY(-5px); box-shadow: 0 20px 44px rgba(0, 0, 0, 0.15); }
.lib-tile video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;   /* the tile itself handles clicks */
}

.lib-tile__sound {
  position: absolute;
  right: 8px; bottom: 8px;
  z-index: 2;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 250ms ease, background 250ms ease;
}
.lib-tile:hover .lib-tile__sound,
.lib-tile.is-playing .lib-tile__sound { opacity: 1; }
.lib-tile__sound:hover { background: var(--pink); }
.lib-tile__sound .lib-ico--on { display: none; }
.lib-tile.has-sound .lib-tile__sound .lib-ico--on { display: block; }
.lib-tile.has-sound .lib-tile__sound .lib-ico--off { display: none; }
.lib-tile.has-sound .lib-tile__sound { background: var(--pink); opacity: 1; }

/* ── Arrows ────────────────────────────────────────────────────────────── */

.lib-arrow {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  display: flex;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--dark);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}
.lib-arrow:hover { transform: scale(1.07); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2); }
.lib-arrow[disabled] { opacity: 0.3; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .lib-tile, .lib-arrow, .lib-tile__sound { transition: none; }
  .lib-tile:hover { transform: none; }
}
