/*
 * Today's Posts: the logo ring and the story viewer (Section 8M, card 160).
 * Loaded on the homepage only. As the prototype and change list item 28
 * ask (owner, Oct 6): the logo-orange ring with a soft glow means posts today
 * this visitor has not seen; a quiet pale-green ring means seen, or nothing new.
 * R3-41: with 2 to 30 stories the ring is one piece per story instead.
 */

/* ---------------------------------------------------------------- ring */

/* Drawn with box-shadow only (a white gap, then the ring), never padding or
   border: the ring changes colour when the reel loads, and anything that changed
   the logo's box would shift the header under the buyer's thumb. */
a.navbar-brand.ys-story-ring {
	border-radius: 14px;
	transition: box-shadow .2s ease;
}

a.navbar-brand.ys-story-ring--new {
	box-shadow: 0 0 0 3px #fff, 0 0 0 5px #F5A23A, 0 0 0 8px rgba(245, 162, 58, .22);
}

/* Change list item 28: "orange when there are unseen posts today, green
   otherwise" (owner, Oct 6: orange as the list asks). Never grey, and plainly
   different -- unseen is the logo orange with a halo, seen (or nothing new
   today) a thin pale green. */
a.navbar-brand.ys-story-ring--seen {
	box-shadow: 0 0 0 3px #fff, 0 0 0 5px #A9D8B1;
}

a.navbar-brand.ys-story-ring:focus-visible {
	outline: 2px solid #1c1c1e;
	outline-offset: 4px;
}

/* R3-41: one piece per story (2 to 30 stories). story-viewer.js lays an SVG
   round the logo, one stroked piece per story, orange (not seen) or green
   (seen); the solid ring's shadow gives way to it. Absolutely placed, so the
   logo's box -- and the header -- never move. */
a.navbar-brand.ys-story-ring {
	position: relative;
}

a.navbar-brand.ys-story-ring--pieces,
a.navbar-brand.ys-story-ring--pieces.ys-story-ring--new,
a.navbar-brand.ys-story-ring--pieces.ys-story-ring--seen {
	box-shadow: 0 0 0 3px #fff;
}

.ys-story-ring__pieces {
	position: absolute;
	overflow: visible;
	pointer-events: none;
}

/* -------------------------------------------------------------- viewer */

/* Round 2, N24, with R3-42's card: a white rounded card on the dimmed,
   blurred homepage -- 12px from each side, 84px from the top and 28px from
   the bottom on a phone, so the page stays visible round it. Inside: the
   thin progress lines, the header row (logo mark (R4-23), "Today's Posts", "Yad
   Shniya · 1/N", the X), the first photo and the caption. */

html.ys-story-open,
html.ys-story-open body {
	overflow: hidden;
	/* The page behind never scrolls while the card is open. */
	overscroll-behavior: none;
}

.ys-story {
	position: fixed;
	inset: 0;
	/* Above the header and Bootstrap's modal (1055); the viewer always closes
	   before it hands off to the listing popup, so they never overlap.
	   R3-42 (owner, Oct 20, signed in as admin on a phone): ALSO above the
	   WordPress toolbar (#wpadminbar, 99999) and the announcement strip
	   (.ys-announce, 100000, which for a signed-in user sits just under the
	   46px toolbar -- across the top of this card). At 2000 both were drawn
	   over the card, hiding its progress line, its header row and the X;
	   signed out there is no toolbar and the strip ends above the card's
	   84px gap. The same level as the business-ad popup (100001). */
	z-index: 100001;
	background: rgba(11, 20, 16, .45);
	-webkit-backdrop-filter: blur(6px) saturate(110%);
	backdrop-filter: blur(6px) saturate(110%);
	overflow: hidden;
	overscroll-behavior: contain;
	touch-action: none;
	cursor: pointer;
	font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
	-webkit-tap-highlight-color: transparent;
	/* Press-and-hold pauses: no text selection, no long-press image menu. */
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
	animation: ys-story-in .18s ease-out;
}

@keyframes ys-story-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* The card. On a phone: 12px each side, 84px above, 28px below. On a
   computer (R4-70): a phone-shaped card, 9 wide to 16 tall, as large as fits
   inside the window with 40px above and below (never taller than 900px),
   centred, the arrows beside it. */
.ys-story__frame {
	position: absolute;
	top: 84px;
	bottom: 28px;
	left: 12px;
	right: 12px;
	display: flex;
	flex-direction: column;
	margin: 0 auto;
	max-width: 420px;
	border-radius: 20px;
	background: #fff;
	color: #1c2a21;
	box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
	overflow: hidden;
	animation: ys-story-card .26s ease-out;
}

@keyframes ys-story-card {
	from { transform: translateY(24px); opacity: .4; }
	to { transform: none; opacity: 1; }
}

@media (min-width: 768px) {
	/* R4-70: the card's height is the window less 80px (40 above, 40 below),
	   at most 900px; its width follows at 9:16. The arrows read the same two. */
	.ys-story {
		--ys-story-h: min(900px, calc(100vh - 80px));
		--ys-story-w: calc(var(--ys-story-h) * 9 / 16);
	}

	@supports (height: 100dvh) {
		.ys-story {
			--ys-story-h: min(900px, calc(100dvh - 80px));
		}
	}

	.ys-story__frame {
		top: 50%;
		bottom: auto;
		left: 50%;
		right: auto;
		width: var(--ys-story-w);
		height: var(--ys-story-h);
		max-width: none;
		margin: calc(var(--ys-story-h) / -2) 0 0 calc(var(--ys-story-w) / -2);
	}
}

/* One thin line per story across the top of the card. */
.ys-story__progress {
	position: relative;
	z-index: 2;
	flex: 0 0 auto;
	display: flex;
	gap: 4px;
	padding: 10px 12px 0;
	pointer-events: none;
}

.ys-story__seg {
	flex: 1 1 0;
	height: 3px;
	border-radius: 2px;
	background: #E0E6E2;
	overflow: hidden;
}

.ys-story__fill {
	display: block;
	width: 0;
	height: 100%;
	background: #2E9E3D;
}

.ys-story__seg.is-done .ys-story__fill {
	width: 100%;
}

.ys-story__seg.is-active .ys-story__fill {
	animation: ys-story-fill 6s linear forwards;
	/* A video ad slide fills over the part that plays (N24 (6)); story-viewer.js
	   sets --ys-story-seg-ms on the segment once the metadata is in. */
	animation-duration: var(--ys-story-seg-ms, 6s);
}

/* R4-54: an ad is one story of as many slides as it has, and each slide has
   its own line (a share of the bar as wide as the slides it has). */
.ys-story__seg--parts {
	display: flex;
	gap: 2px;
	background: none;
	overflow: visible;
}

.ys-story__part {
	flex: 1 1 0;
	height: 3px;
	border-radius: 2px;
	background: #E0E6E2;
	overflow: hidden;
}

.ys-story__part.is-done .ys-story__fill {
	width: 100%;
}

.ys-story__part.is-active .ys-story__fill {
	animation: ys-story-fill 6s linear forwards;
	animation-duration: var(--ys-story-seg-ms, 6s);
}

.ys-story__part.is-active.is-pending .ys-story__fill {
	animation: none;
	width: 0;
}

.ys-story.is-paused .ys-story__part.is-active .ys-story__fill {
	animation-play-state: paused;
}

/* A video's line waits until its length is known. */
.ys-story__seg.is-active.is-pending .ys-story__fill {
	animation: none;
	width: var(--ys-story-fill-from, 0%);
}

/* Press and hold (or a hidden tab, or a video waiting for data): the line stops. */
.ys-story.is-paused .ys-story__seg.is-active .ys-story__fill {
	animation-play-state: paused;
}

@keyframes ys-story-fill {
	from { width: var(--ys-story-fill-from, 0%); }
	to { width: var(--ys-story-fill-to, 100%); }
}

/* The header row under the lines. */
.ys-story__head {
	position: relative;
	z-index: 2;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 4px 8px 12px;
	color: #1c2a21;
}

.ys-story__mark {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #237C30;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .02em;
}

/* R4-23: the site logo in the mark, whole (contain: never cropped or
   stretched), on white with a pale-green edge so the circle reads on the
   white card. The 512px file keeps it sharp on a 3x phone. */
.ys-story__mark--logo {
	overflow: hidden;
	background: #fff;
	box-shadow: inset 0 0 0 1px #B9DDBF;
}

.ys-story__logo {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: contain;
	-webkit-user-drag: none;
}

.ys-story__who {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-width: 0;
	pointer-events: none;
}

.ys-story__name {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
}

.ys-story__count {
	margin: 0;
	font-size: 12px;
	line-height: 1.3;
	color: #5b6b61;
}

/* The X: a 44px target, the cross drawn as two bars. */
.ys-story__close {
	position: relative;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}

.ys-story__close::before,
.ys-story__close::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 2.2px;
	margin: -1.1px 0 0 -10px;
	border-radius: 2px;
	background: #1c2a21;
	transform: rotate(45deg);
}

.ys-story__close::after {
	transform: rotate(-45deg);
}

.ys-story__close:focus-visible {
	outline: 2px solid #237C30;
	outline-offset: 2px;
}

/* The listing: the photo fills what the card has left, the caption under it. */
.ys-story__card {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	cursor: pointer;
}

.ys-story__card:focus-visible {
	outline: 3px solid #237C30;
	outline-offset: -3px;
}

/* One photo, the first. */
.ys-story__photo {
	flex: 1 1 auto;
	min-height: 120px;
	background: #f4f4f5;
}

.ys-story__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	-webkit-user-drag: none;
}

/* R4-70: the blurred, darkened copy of the same picture behind the whole
   picture. Phone: not drawn (the photo fills the box there, as before). */
.ys-story__blur {
	display: none;
}

/* R4-28: the large copy stays hidden until it has loaded; the small feed
   copy (the box background, set by the script) shows meanwhile. */
.ys-story__photo {
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}

.ys-story__img.is-loading {
	visibility: hidden;
}

.ys-story__img[hidden] {
	display: none;
}

.ys-story__body {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 18px 18px;
}

/* The caption alone, up to 4 lines, then "…". */
.ys-story__caption {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	font-size: 18px;
	font-weight: 500;
	line-height: 1.4;
	color: #1c2a21;
	overflow-wrap: anywhere;
}

/* R4-71: "Posted Nov 2, 9:14 am", one small line above the caption. Only
   drawn when the admin's "Show the posted date" switch is on. */
.ys-story__posted {
	margin: 0;
	font-size: 13px;
	line-height: 1.3;
	color: #5b6b61;
}

.ys-story__posted[hidden] {
	display: none;
}

/* An auction's current bid (not in the caption). */
.ys-story__amount {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: #1c2a21;
}

.ys-story__amount[hidden] {
	display: none;
}

.ys-story__hint {
	margin-top: 2px;
	font-size: 16px;
	font-weight: 700;
	color: #237C30;
}

/* R3-42: previous and next arrows beside the card, on a computer only. */
.ys-story__nav {
	display: none;
}

@media (min-width: 768px) {
	.ys-story__nav {
		position: absolute;
		top: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 48px;
		height: 48px;
		margin-top: -24px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: rgba(255, 255, 255, .92);
		box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
		cursor: pointer;
	}

	.ys-story__nav--prev {
		left: 50%;
		margin-left: calc(var(--ys-story-w) / -2 - 72px);
	}

	.ys-story__nav--next {
		left: 50%;
		margin-left: calc(var(--ys-story-w) / 2 + 24px);
	}

	/* A chevron drawn with two borders. */
	.ys-story__nav::before {
		content: "";
		width: 12px;
		height: 12px;
		border-top: 2.5px solid #1c2a21;
		border-right: 2.5px solid #1c2a21;
	}

	.ys-story__nav--prev::before {
		margin-left: 5px;
		transform: rotate(-135deg);
	}

	.ys-story__nav--next::before {
		margin-right: 5px;
		transform: rotate(45deg);
	}

	.ys-story__nav:hover {
		background: #fff;
	}

	.ys-story__nav:focus-visible {
		outline: 2px solid #fff;
		outline-offset: 3px;
	}
}

/* R4-70, on a computer: the WHOLE picture, never cut. It is fitted inside the
   box, in the middle, in its own shape; what is left over is the blurred,
   darkened copy of the same picture (the small file: it is blurred anyway),
   as WhatsApp Status and Instagram Stories do it, with no plain bars. The
   progress lines, the header, the caption and "View full listing" keep their
   places: the photo box is only the space between. */
@media (min-width: 768px) {
	.ys-story__photo {
		position: relative;
		overflow: hidden;
		background-color: #16221b;
		/* The small copy is the blurred layer's now; the box shows no sharp
		   copy behind the picture. */
		background-image: none !important;
	}

	.ys-story__blur {
		display: block;
		position: absolute;
		inset: -32px;
		background-position: center;
		background-repeat: no-repeat;
		background-size: cover;
		filter: blur(24px) brightness(.55) saturate(1.1);
		pointer-events: none;
	}

	.ys-story__img {
		position: relative;
		z-index: 1;
		object-fit: contain;
	}
}

/* A short window (a small laptop): the caption takes less of the card. */
@media (min-width: 768px) and (max-height: 720px) {
	.ys-story__body {
		gap: 6px;
		padding: 10px 14px 12px;
	}

	.ys-story__caption {
		font-size: 15px;
		-webkit-line-clamp: 3;
		line-clamp: 3;
	}

	.ys-story__hint {
		font-size: 14px;
	}
}

.ys-story__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	margin: 0;
}

/* Reduced motion: the stories still advance on the same clock, but nothing
   fades or slides in, and the current line is shown full instead of moving. */
@media (prefers-reduced-motion: reduce) {
	.ys-story,
	.ys-story__frame {
		animation: none;
	}

	.ys-story__seg.is-active .ys-story__fill,
	.ys-story__seg.is-active.is-pending .ys-story__fill {
		animation: none;
		width: var(--ys-story-fill-to, 100%);
	}
}

/* ---------------------------------------------------------- status ads */

/* Cards 146, 161. Its own layer filling the card under the lines and the
   header, never the listing: an ad is not a listing and must not look like one. */
.ys-story__card[hidden],
.ys-story__ad[hidden] {
	display: none;
}

.ys-story__ad {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px;
	text-align: center;
	color: #fff;
	background: #1c2733;
	overflow: hidden;
}

.ys-story__ad--image {
	background: #8b5cf6;
}

.ys-story__ad-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 1;
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .25);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .06em;
}

.ys-story__ad-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

.ys-story__ad-headline {
	margin: 0;
	font-size: clamp(26px, 8vw, 40px);
	font-weight: 800;
	line-height: 1.15;
	overflow-wrap: anywhere;
}

.ys-story__ad-sub {
	margin: 0;
	font-size: 15px;
	opacity: .9;
	overflow-wrap: anywhere;
}

/* R4-54: a text slide's lines and its link are ONE block with no gap: the
   link is directly under the last line, however many lines there are. The
   link is plain underlined words (a pill would add its own padding as a gap)
   with a 44px tap area made by ::after. Also drawn by the Status Ads preview. */
.ys-story__ad-text {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;
	width: 100%;
	max-width: 520px;
}

.ys-story__ad-line {
	margin: 0;
	max-width: 520px;
	font-size: clamp(20px, 6vw, 28px);
	font-weight: 800;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.ys-story__ad-link {
	position: relative;
	display: inline-block;
	max-width: 100%;
	margin: 0;
	padding: 0;
	background: none;
	color: #fff;
	font-size: clamp(16px, 4.6vw, 20px);
	font-weight: 700;
	line-height: 1.3;
	text-decoration: underline;
	text-underline-offset: 3px;
	overflow-wrap: anywhere;
	cursor: pointer;
}

.ys-story__ad-link::after {
	content: "";
	position: absolute;
	inset: -12px -10px;
}

.ys-story__ad-link:hover,
.ys-story__ad-link:focus-visible {
	color: #fff;
	text-decoration-thickness: 2px;
}

/* R4-54: for an admin only -- the last row of the frame, so everything above
   it just has a little less room. Quiet, small, and it ignores taps. */
.ys-story__admincount {
	flex: 0 0 auto;
	margin: 0;
	padding: 6px 12px 8px;
	font-size: 12px;
	line-height: 1.2;
	color: #5b6b61;
	text-align: left;
	background: #fff;
	pointer-events: none;
}

.ys-story__admincount[hidden] {
	display: none;
}

.ys-story__ad-link:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* Video on slide 1 (D8 #66a): fills the layer like the flyer image, and plays
   muted until the viewer taps the sound button, which sits above the video. */
.ys-story__ad-video {
	object-fit: contain;
}

/* N24 (6): a small round speaker button, a 44px target. Muted it shows a
   speaker with a cross; with the sound on, a speaker with a wave. */
.ys-story__ad-unmute {
	position: absolute;
	z-index: 1;
	right: 16px;
	bottom: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	cursor: pointer;
}

.ys-story__speaker svg {
	display: block;
	width: 22px;
	height: 22px;
}

/* Muted shows the crossed speaker; sound on shows the one with waves. */
.ys-story__ad-unmute[aria-pressed="false"] .ys-story__icon-on,
.ys-story__ad-unmute[aria-pressed="true"] .ys-story__icon-off {
	display: none;
}

.ys-story__ad-unmute[aria-pressed="true"] {
	background: rgba(255, 255, 255, .25);
}

.ys-story__ad-unmute:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}
