/* ==========================================================================
   Pure Marketing Design System — Layout utilities
   A deliberately small set. Anything a block needs beyond this belongs in that
   block's own scoped <style>, not here.
   Depends on: tokens.css
   ========================================================================== */

/* -------------------------------------------------------------- stack/flow */
/* Vertical rhythm between direct children. */
.pm-stack {
  display: flex;
  flex-direction: column;
}
.pm-stack--1 > * + * { margin-top: var(--pm-space-1); }
.pm-stack--2 > * + * { margin-top: var(--pm-space-2); }
.pm-stack--3 > * + * { margin-top: var(--pm-space-3); }
.pm-stack--4 > * + * { margin-top: var(--pm-space-4); }
.pm-stack--5 > * + * { margin-top: var(--pm-space-5); }
.pm-stack--6 > * + * { margin-top: var(--pm-space-6); }
.pm-stack--8 > * + * { margin-top: var(--pm-space-8); }
.pm-stack--10 > * + * { margin-top: var(--pm-space-10); }
.pm-stack--12 > * + * { margin-top: var(--pm-space-12); }

/* Horizontal group that wraps. */
.pm-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--pm-space-4);
}
.pm-cluster--2 { gap: var(--pm-space-2); }
.pm-cluster--3 { gap: var(--pm-space-3); }
.pm-cluster--6 { gap: var(--pm-space-6); }
.pm-cluster--8 { gap: var(--pm-space-8); }
.pm-cluster--center { justify-content: center; }
.pm-cluster--end { justify-content: flex-end; }
.pm-cluster--between { justify-content: space-between; }
.pm-cluster--top { align-items: flex-start; }

/* ------------------------------------------------------------------- grid */
.pm-grid {
  display: grid;
  gap: var(--pm-space-6);
}
.pm-grid--gap-2 { gap: var(--pm-space-2); }
.pm-grid--gap-4 { gap: var(--pm-space-4); }
.pm-grid--gap-8 { gap: var(--pm-space-8); }
.pm-grid--gap-10 { gap: var(--pm-space-10); }
.pm-grid--gap-12 { gap: var(--pm-space-12); }
.pm-grid--gap-16 { gap: var(--pm-space-16); }
.pm-grid--gap-20 { gap: var(--pm-space-20); }

/* Mobile-first: everything stacks, then splits at md (768) / lg (992). */
.pm-grid--2,
.pm-grid--3,
.pm-grid--4,
.pm-grid--5,
.pm-grid--6 {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .pm-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pm-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pm-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pm-grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pm-grid--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
  .pm-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pm-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pm-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .pm-grid--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Two-column content/media split used by most feature and header blocks. */
.pm-split {
  display: grid;
  gap: var(--pm-space-12);
  align-items: center;
  grid-template-columns: 1fr;
}
.pm-split--top { align-items: start; }
@media (min-width: 992px) {
  .pm-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--pm-space-20);
  }
  .pm-split--wide-left { grid-template-columns: 1.4fr 1fr; }
  .pm-split--wide-right { grid-template-columns: 1fr 1.4fr; }
  .pm-split--narrow-left { grid-template-columns: 0.8fr 1fr; }
  /* Put the media first in the DOM for a11y, flip it visually here. */
  .pm-split--reverse > :first-child { order: 2; }
  .pm-split--reverse > :last-child { order: 1; }
}

/* ------------------------------------------------------------------ media */
.pm-media {
  /* display:block matters: .pm-media is often put on an <a>, where inline
     layout silently ignores aspect-ratio and collapses the card. */
  display: block;
  width: 100%;
  border-radius: var(--pm-radius-image);
  overflow: hidden;
}
.pm-media img,
.pm-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pm-ratio-1x1 { aspect-ratio: 1 / 1; }
.pm-ratio-3x2 { aspect-ratio: 3 / 2; }
.pm-ratio-4x3 { aspect-ratio: 4 / 3; }
.pm-ratio-16x9 { aspect-ratio: 16 / 9; }
.pm-ratio-2x3 { aspect-ratio: 2 / 3; }
.pm-ratio-3x4 { aspect-ratio: 3 / 4; }
.pm-ratio-9x16 { aspect-ratio: 9 / 16; }

.pm-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Full-bleed background layer inside a positioned section. */
.pm-bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.pm-bg-layer img,
.pm-bg-layer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pm-bg-overlay {
  position: absolute;
  inset: 0;
  background-color: var(--pm-color-overlay);
}
.pm-relative { position: relative; z-index: var(--pm-z-base); }

/* --------------------------------------------------------------- helpers */
.pm-text-center { text-align: center; }
.pm-text-left { text-align: left; }
.pm-text-right { text-align: right; }
.pm-mx-auto { margin-inline: auto; }
.pm-w-full { width: 100%; }
.pm-h-full { height: 100%; }
.pm-measure { max-width: var(--pm-measure); }
.pm-flex-1 { flex: 1 1 0%; }
.pm-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pm-clamp-2,
.pm-clamp-3,
.pm-clamp-4 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pm-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.pm-clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }
.pm-clamp-4 { -webkit-line-clamp: 4; line-clamp: 4; }

.pm-hide { display: none !important; }
@media (max-width: 767px) {
  .pm-hide-sm { display: none !important; }
}
@media (max-width: 991px) {
  .pm-hide-md { display: none !important; }
}
@media (min-width: 992px) {
  .pm-hide-lg { display: none !important; }
}

.pm-scrollbar-none {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pm-scrollbar-none::-webkit-scrollbar {
  display: none;
}

/* ------------------------------------------------------- scroll reveal
   Add data-pm-reveal to any element. pm-design-system.js flips
   data-pm-revealed="true" when it scrolls into view. */
[data-pm-reveal] {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity var(--pm-duration-slow) var(--pm-ease-out),
    transform var(--pm-duration-slow) var(--pm-ease-out);
}
[data-pm-reveal][data-pm-revealed="true"] {
  opacity: 1;
  transform: none;
}
[data-pm-reveal][data-pm-delay="1"] { transition-delay: 80ms; }
[data-pm-reveal][data-pm-delay="2"] { transition-delay: 160ms; }
[data-pm-reveal][data-pm-delay="3"] { transition-delay: 240ms; }
[data-pm-reveal][data-pm-delay="4"] { transition-delay: 320ms; }

@media (prefers-reduced-motion: reduce) {
  [data-pm-reveal] { opacity: 1; transform: none; }
}
