/* Depends on: base.css, viewport.css, modal.css, section-1.css (the
   "view all" button reuses .s1-panel-link's look/hover wholesale — see
   the note above .s4-viewall below). */

/* ============================================================
   SECTION 4 — LICYTACJE CHARYTATYWNE
   ============================================================
   A simple two-line heading sits above a full-bleed horizontal photo
   carousel of 13 items. The arrows and the "WSZYSTKIE LICYTACJE"
   button are visible and usable from the very start — the section's
   one scroll-step just nudges the strip over by exactly one photo (a
   one-off "hey, this scrolls" cue), handled entirely in section-4.js;
   nothing here is gated behind [data-step] any more. Nothing here
   ever repositions an element between two different CSS positioning
   schemes either (that's what made an earlier version of this section
   fragile) — the heading and viewport stay exactly where they are the
   whole time; only the track's own transform (a plain translateX)
   ever changes. */
#slide-s4 {
  background: var(--burgundy);
  color: var(--paper);
}

.s4-stage {
  position: absolute;
  inset: 0;
  padding-top: var(--header-h);
  /* Safety net, not the primary fix: title+carousel+pager+button
     is a lot of stacked content, and on a short enough viewport it can
     add up to more than 100vh even after the trims below. Rather than
     let the excess be silently clipped by .slide's own overflow:hidden
     (which is what was swallowing the "WSZYSTKIE LICYTACJE" button),
     this lets THIS section scroll internally — scroll-engine.js's own
     findScrollableAncestor() already knows to hand wheel/touch events
     to a genuinely overflowing auto/scroll element like this one
     before treating them as a section change, the same mechanism
     Section 2's mobile bento list relies on. A no-op when everything
     already fits, which is the common case this is sized for. */
  overflow-y: auto;
}

.s4-flex {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Trimmed from 4vh, then again from 2vh — see the .s4-stage comment
     above: this section's stacked content is tall, and every gap here
     is one of several competing for the same limited headroom. Halving
     the title (see .s4-title) is what bought most of the room needed to
     get the WSZYSTKIE LICYTACJE button above the fold; on a short
     window (a laptop with a lot of browser chrome, around 695px of
     viewport) that left the button's last couple of pixels still under
     the edge, and there are three of these gaps, so a small trim here
     is worth more than its size suggests. */
  gap: 1.4vh;
}

.s4-title {
  margin: 0;
  text-align: center;
  font-family: var(--display); font-weight:800;
  line-height: 1.05;
  letter-spacing: 0.01em;
  /* Purely a paint-time shift — transform never participates in layout,
     so this cannot move .s4-carousel-wrap or anything below it even by
     a pixel, however far down this pushes the title itself. That's the
     point: the title needed clearing from the header (same problem
     Section 3's caption had), but the carousel's own position had to
     stay exactly where it already was. */
  transform: translateY(3vh);
  /* Ordinary text wrap (the markup is now one plain text node, not two
     forced-block spans) merges this onto a single line whenever it
     fits and wraps at the word space back to two once it doesn't — the
     existing vw-scaled clamp already shrinks the font as the viewport
     narrows, which is what makes "fits" happen at wide widths and
     "doesn't" at narrow ones, without a breakpoint needed either way.

     Half the size it was (clamp(2.2rem, 6vw, 4.6rem)). Everything in
     this section is stacked in one centred column — title, carousel,
     button — and at the old size the column came to more than
     a screenful: the WSZYSTKIE LICYTACJE button at the bottom was
     pushed below the fold and only appeared once the section was
     scrolled, which is not where a call to action is any use. The
     title was the one piece with height to spare. */
  font-size: clamp(1.1rem, 3vw, 2.3rem);
}

/* ------------------------------------------------------------
   Carousel
   ------------------------------------------------------------
   Full-bleed: .s4-viewport is never padded away from the screen's own
   left/right edges, so the strip genuinely starts flush against them.
   Each .s4-item holds one photo (.s4-slide) plus its own "LICYTACJA"
   link UNDERNEATH it (not overlaid on the photo) — the image itself is
   what's clickable to open the full lightbox on that exact photo. */
.s4-carousel-wrap {
  position: relative;
  width: 100%;
}
.s4-viewport {
  width: 100%;
  overflow: hidden;
  /* .s4-viewport's own overflow:hidden is what actually hides
     off-screen photos — but with zero spare room, it was ALSO
     clipping the hover-lift and the active photo's glow right at its
     top edge (there was no such visible clipping at the bottom, since
     the LICYTACJA button below each photo already provides slack
     there). This padding gives both room to breathe without exposing
     the strip's scrolled-off neighbours. */
  padding: 30px 0;
  cursor: grab;
  /* NOT pan-y: on a touchscreen, a pan-y element still lets the browser
     decide a gesture is a vertical pan the instant it looks even
     slightly vertical, which can cancel the pointer sequence section-4.js
     needs mid-drag before a horizontal swipe ever gets going — this was
     the actual cause of finger-dragging not working reliably on mobile.
     `none` hands EVERY touch gesture over this element to script
     instead. Section-to-section swipe navigation still works exactly
     as before regardless: it's driven by scroll-engine.js's own
     window-level touchstart/touchend listeners, which read touch
     coordinates directly rather than depending on native panning, and
     which already ignore a mostly-horizontal swipe as "belongs to a
     carousel, not section navigation" (see the comment on that check in
     scroll-engine.js) — so a genuine vertical swipe that happens to
     start over the carousel still changes sections correctly. */
  touch-action: none;
}
.s4-viewport.dragging {
  cursor: grabbing;
}
/* While actively dragging, the track needs to track the pointer
   1:1 with no lag — the eased transition below is only for
   arrow/step moves. */
.s4-viewport.dragging .s4-track {
  transition: none;
}
.s4-track {
  display: flex;
  gap: 1.4vw;
  transition: transform 0.7s var(--ease);
  will-change: transform;
}
/* Sized from section-4.js to exactly half a viewport-width minus half
   a photo-width, at each end of the track — so at rest (offset 0) the
   FIRST photo lands centered in the section instead of jammed against
   the left edge, and the strip can likewise center the LAST photo when
   scrolled all the way. */
.s4-track-spacer {
  flex: 0 0 auto;
}
.s4-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7em;
}
.s4-slide {
  position: relative;
  /* Trimmed from min(56vh, 480px) — part of the same headroom-reclaiming
     fix as .s4-flex's gap above. */
  height: var(--s4-photo-h);
  aspect-ratio: 1080 / 1350;
  /* border-radius here (without overflow:hidden — see .s4-slide img
     below for the actual clipping) purely so the box-shadow/glow
     below is drawn following the same rounded corners. overflow:hidden
     on THIS element would clip its own box-shadow entirely (a general
     CSS quirk: an element's overflow always clips its own shadow),
     which is exactly what was cutting the glow off before. */
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.3s var(--ease),
    box-shadow 0.3s ease;
}
/* Hover: lift the photo slightly, same idea as the bento boxes in
   section 2. */
.s4-slide:hover {
  transform: translateY(-10px);
}
.s4-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  /* Without this, the browser's own native image-drag (a ghost image
     you can drop onto the address bar/desktop) kept hijacking mouse
     drags meant for scrubbing the carousel. */
  -webkit-user-drag: none;
  user-select: none;
}
/* Whichever photo currently sits closest to the viewport's own centre
   (kept in sync from section-4.js's renderS3(), on every scroll/drag/
   arrow move) gets a pulsing glow traced around it, so it's always
   obvious which one is "the" carousel photo right now. */
.s4-slide.active {
  animation: s4Glow 2s ease-in-out infinite;
}
@keyframes s4Glow {
  0%,
  100% {
    box-shadow:
      0 14px 34px rgba(0, 0, 0, 0.3),
      0 0 0 2px var(--gold-light),
      0 0 16px 3px rgba(201, 154, 46, 0.55);
  }
  50% {
    box-shadow:
      0 14px 34px rgba(0, 0, 0, 0.3),
      0 0 0 2px var(--gold-light),
      0 0 28px 9px rgba(201, 154, 46, 0.85);
  }
}

/* Gold rather than the shared .btn-cta's default burgundy — these
   buttons sit directly on the section's own burgundy background now
   (moved below the photo, not overlaid on top of it), where a
   burgundy button would have almost no contrast at all. Also applied
   to the lightbox's own LICYTACJA button (.s4-lightbox-cta) so the
   two match. */
.s4-slide-cta,
.s4-lightbox-cta {
  background: var(--gold);
  color: var(--ink);
}
/* Simpler hover than the shared .btn-cta's lift + 3D shadow: keep the
   button looking exactly as it does at rest and just grow it slightly. */
.s4-slide-cta:hover,
.s4-lightbox-cta:hover {
  background: var(--gold);
  box-shadow: none;
  transform: scale(1.06);
}
.s4-slide-cta {
  font-size: 0.8rem;
  padding: 0.6em 1.4em;
}

/* ------------------------------------------------------------
   Arrows beside the centred photo (see ref.png in the s4 images)
   ------------------------------------------------------------
   Every item before the active one is pushed left and every item after
   it pushed right by --s4-push (classes set in section-4.js's
   s4UpdateActive()), opening a gap on each side of the centred photo
   that the two arrows sit in. A transform rather than a margin, so the
   track's layout — and all the offsetLeft-based centring maths — stays
   exactly as it was. */
.s4-carousel-wrap {
  --s4-photo-h: min(48vh, 420px);
  --s4-photo-w: calc(var(--s4-photo-h) * 1080 / 1350);
  --s4-push: 90px;
}
.s4-item {
  transition: transform 0.5s var(--ease);
}
.s4-item--before {
  transform: translateX(calc(-1 * var(--s4-push)));
}
.s4-item--after {
  transform: translateX(var(--s4-push));
}

/* Bare hand-drawn glyphs — no circle, no fill, no button background —
   same construction as .s1-panel-arrow (Section 1's ROZKŁAD JAZDY/
   ORGANIZATORZY buttons): an open, round-capped stroke coloured via
   currentColor rather than an icon font or a filled shape. Centred
   vertically on the photo (the viewport's 30px top padding + half the
   photo) and horizontally in the middle of the gap beside it (half
   the photo + half of the track gap plus the push). Centred with
   negative margins rather than a transform, so the hover scale below
   has transform to itself. */
.s4-arrow {
  position: absolute;
  z-index: 2;
  top: calc(30px + var(--s4-photo-h) / 2);
  width: 56px;
  height: 28px;
  margin: -14px 0 0 -28px;
  border: none;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  /* Same blue as the event logo (assets/images/logo/event_logo/
     event_logo_alt_duo.svg's own fill — #0bbbef), reused as a literal
     hex rather than a variable since that's how this color is already
     handled everywhere else it shows up on the site (Section 2's
     wallpaper, Section 3's tagline pill, the brand logotype). */
  color: #0bbbef;
  cursor: pointer;
  transition:
    color 0.2s ease,
    transform 0.2s var(--ease);
}
.s4-arrow.left {
  left: calc(50% - var(--s4-photo-w) / 2 - (1.4vw + var(--s4-push)) / 2);
}
.s4-arrow.right {
  left: calc(50% + var(--s4-photo-w) / 2 + (1.4vw + var(--s4-push)) / 2);
}
.s4-arrow:hover {
  color: #7fdcff; /* a lighter tint of the same blue, not an unrelated hover hue */
  transform: scale(1.1);
}
/* Fully gone at either end, not just faded — no LEFT arrow once
   there's nothing left of the first photo to scroll back to, and the
   same for RIGHT at the last one. section-4.js sets the native
   `disabled` property for exactly this. */
.s4-arrow:disabled {
  display: none;
}
.s4-arrow-icon {
  width: 56px;
  height: 28px;
  stroke: currentColor;
}
/* The right-pointing SVG mirrored, rather than a second hand-authored
   path — keeps the two arrows' geometry identical by construction. */
.s4-arrow.left .s4-arrow-icon {
  transform: scaleX(-1);
}

/* "view all" — a normal flex item right below the carousel, so the
   title+carousel+button group is centered as ONE block (an earlier
   version pulled this out to an absolutely-positioned spot instead,
   which threw that centering off — the group's visual middle no
   longer matched the section's actual middle). Looks and animates
   exactly like section 1's ROZKŁAD JAZDY/ORGANIZATORZY buttons
   (.s1-panel-link, including its slide-swap text hover — see
   section-1.css); this just bumps it 50% bigger (padding/border scale
   right along with the font-size since .s1-panel-link sizes both in
   em/px relative to it). */
.s4-viewall {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  border-width: 3px;
}
/* A simple 2×2 grid to the right of the label, in place of Section 1's
   arrow: this button opens a grid of every auction, so the icon says
   so. Every few seconds it gives a short wobble and settles back to
   exactly its resting position. The keyframes hold still for most of
   the cycle, so it reads as an occasional nudge, not a constant spin. */
.s4-grid-icon {
  width: 0.75em;
  height: 0.75em;
  flex: none;
  fill: currentColor;
  animation: s4GridWobble 4s ease-in-out infinite;
}
@keyframes s4GridWobble {
  0%,
  70%,
  100% {
    transform: rotate(0deg);
  }
  76% {
    transform: rotate(18deg);
  }
  82% {
    transform: rotate(-12deg);
  }
  88% {
    transform: rotate(6deg);
  }
  94% {
    transform: rotate(0deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .s4-grid-icon {
    animation: none;
  }
}

/* ============================================================
   The two popups
   ============================================================
   #s4AllModal   — every auction photo at once, as a grid
                   ("WSZYSTKIE LICYTACJE").
   #s4PhotoModal — one photo, full screen, with its own LICYTACJA
                   button (a carousel photo, or one picked out of the
                   grid).

   Both use the same shared .modal/.modal.open mechanics (and the same
   body-scroll-lock behaviour: opening any modal already blocks the
   site's own scroll-hijack navigation — see openModals in
   scroll-engine.js) as every other popup on the site. */
.modal.s4-lightbox {
  background: var(--ink);
  align-items: stretch;
  justify-content: stretch;
}
/* Needed since the grid below is also position:absolute; inset:0 and
   comes later in the DOM — without this it would paint on top of (and
   swallow clicks meant for) the close button, the same pitfall
   .organizers-modal's own .modal-close z-index already works around
   for the same reason. */
.s4-lightbox-close {
  z-index: 5;
}
.s4-lightbox-close svg {
  stroke: var(--paper-2);
}
/* The whole popup is the grid now — it used to be a narrow column of
   thumbnails beside one big image, which meant a photo picked here was
   shown at about the size it already was in the carousel behind. It
   scrolls if 13 photos do not fit at once.

   auto-fill + minmax rather than a fixed column count: the tiles stay
   within a sensible size band and the number per row simply follows
   the width, so there is no breakpoint to keep in step with the
   layout. */
.s4-lightbox-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 40vw), 1fr));
  /* Both of these are load-bearing, and for the same reason. This grid
     has a definite height (it is inset:0 on the popup), while the tiles
     inside it are sized by their photo's ratio off a percentage width —
     which the row-sizing algorithm cannot resolve, so it fell back to
     dividing its own height evenly between the three rows and every
     tile came out shorter than its photo, clipping the bottom off all
     13. max-content says "a row is as tall as what is in it", and
     start stops the tiles being stretched to the row on top of that.
     (Section 3's stacked bento boxes hit the identical problem — see
     the grid-auto-rows note in section-3.css.) */
  grid-auto-rows: max-content;
  align-items: start;
  align-content: start;
  gap: clamp(8px, 1vw, 16px);
  padding: 9vh clamp(16px, 3vw, 48px) clamp(24px, 4vh, 48px);
  overflow-y: auto;
}
/* No aspect-ratio and no object-fit: the tile is whatever shape its
   own photo is. Forcing every tile to one ratio and cropping the photo
   to fill it only ever agreed with the artwork by luck — these are
   posters, and a poster cropped at the edges loses the part that says
   what it is. */
.s4-lightbox-thumb {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  opacity: 0.85;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition:
    opacity 0.2s ease,
    outline-color 0.2s ease,
    transform 0.2s ease;
}
.s4-lightbox-thumb:hover {
  opacity: 1;
  transform: scale(1.03);
}
.s4-lightbox-thumb.active {
  opacity: 1;
  outline-color: var(--paper-2);
}
.s4-lightbox-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---- one photo, full screen ---- */
.modal.s4-photo-modal {
  background: rgba(12, 9, 7, 0.92);
}
.s4-photo-close {
  z-index: 5;
}
.s4-photo-close svg {
  stroke: var(--paper-2);
}
/* Fills the popup so the empty space around the photo is part of this
   box — that is what makes "click beside the photo to close" (wired in
   section-4.js) cover the whole backdrop rather than a strip of it. */
.s4-photo-body {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2em;
  padding: 9vh clamp(16px, 4vw, 56px) clamp(20px, 4vh, 48px);
}
.s4-photo-body img {
  min-height: 0;
  max-width: 100%;
  flex: 0 1 auto;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
}
.s4-lightbox-cta {
  flex: none;
}

@media (max-width: 760px) {
  /* ---- no arrows on a phone ----
     The centred photo takes most of the screen width, leaving no room
     beside it for the arrows; dragging the strip with a finger is the
     natural gesture there anyway. With no arrows to make room for,
     the neighbours are not pushed out either. */
  .s4-carousel-wrap {
    --s4-push: 0px;
  }
  .s4-arrow {
    display: none;
  }
}

/* ------------------------------------------------------------
   Finished auctions
   ------------------------------------------------------------
   Everything in the strip except the last item is an auction that has
   already closed, marked .s4-item--done in the markup. Two things say
   so: the photo is drained of colour, and the LICYTACJA link under it
   is replaced by a stamp that isn't a link at all.

   The grey is a hover-to-reveal rather than a permanent wash — the
   shirts are the whole point of the section, and holding one under the
   cursor brings it back exactly as it was. Applied to the <img> and
   not to .s4-slide, deliberately: a filter on the slide would drain
   its box-shadow too, which is what draws the active photo's gold
   glow. */
.s4-item--done .s4-slide img {
  filter: grayscale(1);
  transition: filter 0.45s ease;
}
.s4-item--done .s4-slide:hover img {
  filter: grayscale(0);
}

/* The stamp that replaces LICYTACJA on those items, and the matching
   one in the full-screen view. Built like Section 1's badges rather
   than like .btn-cta beside it — mismatched corner radii and a slight
   tilt, so it reads as something pressed onto the card after the fact
   instead of another button to press. It is a <span>: there is nothing
   left to click on a closed auction, and it should not invite the
   attempt (hence `cursor: default`, overriding .s4-slide's grab
   cursor, and no hover state of its own). */
.s4-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display); font-weight:800;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 0.6em 1.4em;
  /* A warm grey rather than a neutral one — it sits on burgundy, and
     a cold grey read as a hole punched in the section. */
  background: #6e6862;
  color: var(--white);
  border-radius: 225px 15px 255px 15px / 15px 245px 15px 225px;
  transform: rotate(-1.8deg);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
/* `display: inline-flex` above would otherwise beat the UA stylesheet's
   own `[hidden] { display: none }`, and the lightbox's copy is toggled
   with exactly that attribute. */
.s4-stamp[hidden] {
  display: none;
}
.s4-lightbox-stamp {
  flex: none;
  font-size: 0.95rem;
}
/* The "view all" grid is the same set of photos in another shape, so
   the closed ones read the same way there — grey, colour on hover.
   The class is put on each thumb by s4BuildLightbox() in section-4.js,
   copied from whether its carousel item is .s4-item--done. */
.s4-lightbox-thumb.done img {
  filter: grayscale(1);
  transition: filter 0.45s ease;
}
.s4-lightbox-thumb.done:hover img {
  filter: grayscale(0);
}

/* Teaser lots — the ones carrying "wkrótce" instead of a button
   (.s4-item--soon in the markup) — are shown blurred, so the strip
   hints at what is coming without giving the shirts away before the
   auction opens. Like the grey above it goes on the <img>, not on
   .s4-slide, so the active photo's glow (a box-shadow) stays sharp.
   The same blur is repeated on the grid thumbs (.soon, set by
   s4BuildLightbox()) and on the full-screen photo (.soon, toggled by
   s4SetLightboxActive()), both in section-4.js. */
.s4-item--soon .s4-slide img,
.s4-lightbox-thumb.soon img,
#s4LightboxImg.soon {
  filter: blur(14px);
  /* clip-path applies after the filter, so the blur can't smear past
     the photo's own edges (there is no overflow:hidden to stop it). */
  clip-path: inset(0 round 14px);
}
#s4LightboxImg.soon {
  clip-path: inset(0 round 10px);
}

/* Lots that have not opened for bidding yet. Deliberately NOT the
   filled gold of a live LICYTACJA button — it is the same pill at the
   same size, but drawn as an outline, so it reads as the same kind of
   thing in a state that is not ready rather than as a button that
   simply ignores you. `cursor: default` and no hover lift say the same
   again; the markup backs it up by being a <span>, so there is nothing
   to click in the first place. */
.s4-slide-soon,
.s4-lightbox-soon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display); font-weight:800;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--gold-light);
  background: transparent;
  border: 2px dashed var(--gold-light);
  border-radius: 999px;
  cursor: default;
  user-select: none;
  opacity: 0.8;
}
/* Matches .s4-slide-cta's own size, so a strip mixing the two keeps one
   line of buttons rather than two heights. The 2px border is taken out
   of the padding for the same reason. */
.s4-slide-soon {
  font-size: 0.8rem;
  padding: calc(0.6em - 2px) calc(1.4em - 2px);
}
.s4-lightbox-soon {
  flex: none;
  font-size: 1rem;
  padding: calc(0.95em - 2px) calc(2.1em - 2px);
}
/* Same reason as .s4-stamp[hidden] above: the display declaration
   would otherwise beat the UA stylesheet's own [hidden] rule, and the
   lightbox toggles this one with exactly that attribute. */
.s4-slide-soon[hidden],
.s4-lightbox-soon[hidden] {
  display: none;
}
