/* Pattison Shorts Carousel — Shorts Widget */

* { box-sizing: border-box; }

  /* ── Section wrapper ── */
  /* overflow-x:clip prevents a horizontal scrollbar without creating a scroll container,
     so the track can visually bleed off the right edge */
  /* width:100vw + the negative margin trick breaks the wrap out of .content-container.content-width
     (which is padded/max-width-constrained) so it spans the full viewport regardless of nesting depth */
  .pw-shorts-widget-wrap {
    padding: 2.5rem 0px;
    overflow-x: clip;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    --pw-inset: max(
      var(--content-margin),
      calc((100vw - var(--content-width)) / 2 + var(--content-margin))
    );
  }
  .pw-shorts-widget-container {
    padding-left: var(--pw-inset);
    padding-right: var(--pw-inset);
  }

  /* ── Header row: title + arrows ── */
  .pw-shorts-widget-header {
    display: flex;

    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;

    transition: margin-left 0.4s cubic-bezier(.22, 1, .36, 1);
  }
  
  .pw-shorts-widget-heading {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 700;
    margin: 0;
    line-height: 1;
  }
  
  /* Single pill that wraps both arrows */
  .pw-shorts-widget-nav {
    display: inline-flex;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 15px;
    padding: 6px 6px;
    gap: 0;
  }
  
  .pw-shorts-widget-btn {
    width: 44px; height: 36px;
    border-radius: 10px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .18s ease, opacity .18s ease;
    padding: 0;
  }
  .pw-shorts-widget-btn:hover { background-color: rgba(0,0,0,0.07); }
  .pw-shorts-widget-btn svg { width: 18px; height: 18px; stroke: #5a5a6e; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  .pw-shorts-widget-btn:disabled { opacity: 0.3; pointer-events: none; }
  
  /* ── Track ── */
  /* Bleeds the track to the right viewport edge. The container's content box is
     centred (padded equally by --pw-inset), so 50% is half its width and
     50% - 50vw is exactly -1 * --pw-inset — self-correcting at any inset.
     Do NOT use calc(-1 * var(--pw-inset)) here: --content-margin is a
     percentage, and it would resolve against the container's *already inset*
     content box rather than the viewport, leaving a gap on the right. */
  .pw-shorts-widget-track-outer {
    margin-right: calc(50% - 50vw);
    padding-block: 16px;
    margin-block: 0px;
    overflow: hidden;
    /* Let stickers overhang the card edge (TL sticker is centred on its corner)
       instead of being clipped on the first card; browsers without
       overflow-clip-margin fall back to the hidden clip above */
    overflow: clip;
    overflow-clip-margin: 10px;
    transition: margin-left 0.4s cubic-bezier(.22, 1, .36, 1);
  }
  
  .pw-shorts-widget-track {
    display: flex;
    gap: 24px;
    cursor: grab;
    transition: transform .48s cubic-bezier(.22, 1, .36, 1);
    will-change: transform;
  }
  .pw-shorts-widget-track.pw-is-dragging {
    cursor: grabbing;
    user-select: none;
  }
  .pw-shorts-widget-track.pw-is-dragging .pw-shorts-widget-card {
    cursor: grabbing;
  }
  
  /* ── Each card+title item ── */
  .pw-shorts-widget-item { flex: 0 0 375px; width: 375px; }
  
  /* ── Card ── */
  .pw-shorts-widget-card {
    position: relative;
    width: 375px;
    height: 670px;
    border-radius: 1.5rem;
    border: 7px solid var(--primary-accent);
    outline: 2px solid #FFFFFF;
    outline-offset: 0;
    background-color: var(--primary-accent);
    cursor: grab;
    box-shadow: 0 20px 35px -24px rgba(0,0,0,.3);
  }
  
  /* ── Stretched card link — makes the whole card (not just the title below
     it) navigate to the post. Sits under the badge/stickers/play-btn so
     those stay independently clickable; visually invisible and hidden from
     assistive tech/keyboard nav since the title link below already covers
     that with real link text. ── */
  .pw-shorts-widget-card .pw-slide-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: inherit; /* preserve the card's grab/grabbing cursor instead of the link's default pointer */
  }

  /* ── Category badge on card ── */
  .pw-shorts-widget-card .pw-shorts-widget-badge {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background-color: var(--primary-accent);
    color: #FFFFFF;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0.15rem 1rem;
    border-radius: 999px;
    white-space: nowrap;
  }
  
  /* ── Media (image + video) ── */
  .pw-shorts-widget-card .pw-slide-media {
    position: absolute;
    inset: 0;
    border-radius: calc(1.5rem - 5px);
    overflow: hidden;
    background-color: #111;
  }
  .pw-shorts-widget-card .pw-slide-media img,
  .pw-shorts-widget-card .pw-slide-media video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; object-position: top;
    display: block;
  }
  .pw-shorts-widget-card .pw-slide-video { opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s linear .5s; }
  .pw-shorts-widget-card:hover .pw-slide-video,
  .pw-shorts-widget-card.pw-is-playing .pw-slide-video { opacity: 1; visibility: visible; transition-delay: 0s; }
  
  /* ── Play button ── */
  .pw-shorts-widget-card .pw-slide-play-btn {
    position: absolute;
    top: 50%; left: 50%;
    overflow: hidden;
    width: 64px; height: 64px;
    border-radius: 999px;
    background-color: #000000B3;
    border: 2px solid #FFFFFF;
    /* Decorative only — no click handler — so let clicks fall through to the
       stretched card link beneath it. */
    pointer-events: none;
    transform: translate(-50%, -50%);
    display: flex; align-items: center; justify-content: center;
    z-index: 3;
    transition: transform .35s cubic-bezier(.22,1,.36,1), background-color .35s cubic-bezier(.22,1,.36,1), box-shadow .35s cubic-bezier(.22,1,.36,1);
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
  }
  .pw-shorts-widget-item:hover .pw-slide-play-btn { transform: translate(-50%,-50%) scale(1.08); background-color: #000000e6; box-shadow: 0 12px 32px rgba(0,0,0,.35); }
  .pw-shorts-widget-card .pw-slide-play-btn svg { width: 24px; height: 24px; fill: #FFFFFF!important; margin-left: 3px; }
  
  /* ── Duration pill ── */
  .pw-shorts-widget-card .pw-slide-duration {
    position: absolute;
    bottom: 0.85rem; left: 0.85rem;
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.35rem 0.7rem 0.35rem 0.55rem;
    background-color: #00000040;
    color: #FFFFFF;
    border-radius: 999px;
    font-size: 0.78rem; font-weight: 700;
    z-index: 3;
    backdrop-filter: blur(8px);
  }
  .pw-shorts-widget-card .pw-slide-duration svg { width: 12px; height: 12px; fill: currentColor; }
  
  /* ── Stickers ── all visible, spring in once, hover bounce */
  .pw-shorts-widget-card .pw-slide-sticker {
    position: absolute;
    width: clamp(100px, 18%, 80px);
    aspect-ratio: 1 / 1;
    object-fit: contain;
    z-index: 4;
    translate: -50% -50%;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,.25));
    opacity: 1; scale: 1; rotate: 0deg;
    pointer-events: auto;
    transition: scale .25s cubic-bezier(.34, 1.56, .64, 1), rotate .25s cubic-bezier(.34, 1.56, .64, 1);
  }
  .pw-shorts-widget-item:hover .pw-slide-sticker { scale: 1.15; rotate: 5deg; }
  
  /* When a sticker is a link, make the <a> itself the block so the img fills it */
  .pw-shorts-widget-card a.pw-slide-sticker { display: block; }
  .pw-shorts-widget-card a.pw-slide-sticker img { width: 100px; height: 100px; object-fit: contain; display: block; }
  .pw-shorts-widget-card a.pw-slide-sticker:hover img { opacity: 1; }

  /* ── Card title below card ── */
  .pw-shorts-widget-card-title {
    margin: 25px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--body-text);
    text-align: center;
  }
  .pw-shorts-widget-card-title a,
  .pw-shorts-widget-card-title a:hover {
    color: var(--body-text);
  }
  @media (max-width: 640px) {
.pw-shorts-widget-card-title {
  text-align:left;
}
  }
  
  @media (max-width: 640px) {
    .pw-shorts-widget-header {
      margin-left: var(--content-margin);
      margin-right: var(--content-margin);
    }
    .pw-shorts-widget-track-outer {
      margin-left: 0px;
    }
    .pw-shorts-widget-heading {
      font-size: 40px;
    }
  }

  /* ── Narrow phones ── */
  /* The 375px fixed card + its left inset (--content-margin, 6% below 640px)
     is wider than the viewport up to ~399px (375 / (1 - 0.06)), so a plain
     "< 380px" check still let it bleed off the right edge on 390px phones
     like the iPhone 12/13/14. Use 480px as a generous cutoff instead of
     computing the exact inset-aware breakpoint, so any current or future
     content-margin value stays covered. Cancel the track-outer right bleed
     and let the single visible card fill the container's content box, which
     is already padded equally by --pw-inset on both sides — giving it
     matching left/right gutters. height:auto + aspect-ratio keeps the card's
     proportions as it narrows. */
  @media (max-width: 480px) {
    .pw-shorts-widget-track-outer {
      margin-right: 0;
    }
    .pw-shorts-widget-item {
      flex-basis: 100%;
      width: 100%;
    }
    .pw-shorts-widget-card {
      width: 100%;
      height: auto;
      aspect-ratio: 375 / 670;
    }
  }
  
  /* ── Optional side content column ──
     Widget setting "Side Content" (horizontal layout only): an image, the
     widget title and a block of text to the left of the track, with the arrows
     tucked under the track's right end. The title is rendered into this column
     instead of the header row — see shortsVideoSlider.php.

     Placed at the end of the file on purpose: these restate selectors the base
     layout and its 640px block already use, at the same specificity, so they
     only win by coming later. */
  .pw-shorts-widget-wrap.pw-has-side-content {
    --pw-side-width: 320px;
    --pw-side-gap: 3.5rem;
  }
  .pw-has-side-content .pw-shorts-widget-container {
    display: grid;
    grid-template-columns: var(--pw-side-width) minmax(0, 1fr);
    column-gap: var(--pw-side-gap);
    align-items: start;
  }

  .pw-shorts-widget-side {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  .pw-shorts-widget-side-image {
    display: block;
    max-width: 100%;
    height: auto;
  }
  .pw-shorts-widget-side-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--body-secondary-text);
  }
  .pw-shorts-widget-side-text p { margin: 0 0 1em; }
  .pw-shorts-widget-side-text p:last-child { margin-bottom: 0; }
  /* One step down from the full-width heading — it has a third of the room. */
  .pw-has-side-content .pw-shorts-widget-heading {
    font-size: clamp(2rem, 2.6vw, 3rem);
    /* Doubles the space above the title: this sits on top of the column's own
       1.25rem gap, so the image clears the heading by 2.5rem. */
    padding-top: 1.25rem;
  }

  .pw-has-side-content .pw-shorts-widget-track-outer {
    grid-column: 2;
    grid-row: 1;
    /* The track still bleeds off the right viewport edge, but its containing
       block is now the second grid column rather than the whole container, so
       the base rule's 50% is half of THAT. Adding back half the side column
       plus the gap restores the original -1 * --pw-inset. Derived from the two
       variables above so it stays correct if either changes. */
    margin-right: calc(50% - 50vw + (var(--pw-side-width) + var(--pw-side-gap)) / 2);
  }
  /* Header is just the arrows now, sitting under the track's right end. */
  .pw-has-side-content .pw-shorts-widget-header {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-end;
    margin: 1.5rem 0 0;
  }

  /* Phones: the column becomes a block above the slider (image, title, text),
     then the track at full bleed, then the arrows. */
  @media (max-width: 640px) {
    .pw-has-side-content .pw-shorts-widget-container {
      grid-template-columns: minmax(0, 1fr);
      row-gap: 1.5rem;
    }
    .pw-has-side-content .pw-shorts-widget-side {
      grid-column: 1;
      grid-row: 1;
    }
    .pw-has-side-content .pw-shorts-widget-track-outer {
      grid-column: 1;
      grid-row: 2;
      /* Full-width column again, so the base bleed applies unadjusted. */
      margin-right: calc(50% - 50vw);
    }
    .pw-has-side-content .pw-shorts-widget-header {
      grid-column: 1;
      grid-row: 3;
      /* The base 640px rule insets the header by --content-margin on top of the
         container's own padding; here it has to line up with the side text. */
      margin: 0;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .pw-shorts-widget-track { transition: none; }
    .pw-shorts-widget-card .pw-slide-sticker { transition: none; }
    .pw-shorts-widget-header,
    .pw-shorts-widget-track-outer { transition: none; }
  }
  