/*
 * The listing popup's pieces this plugin draws (cards 154, 155, 158, and the
 * popup speed/redesign pass): Share, the contact buttons with icons, gallery
 * arrows and dots, the loading skeleton, the small sold link and More from
 * this seller (change list item 35), and the same pieces on the shared-link
 * listing page (.ys-single). Scoped to .product-detail-modal, the theme's
 * modal; the frame itself (the sheet, header row) is the theme's
 * css/modal.css.
 *
 * Palette: brand green #2E9E3D (#237A30 as text on white), ink #161B17,
 * WhatsApp green #25D366 (with ink text: white on it fails WCAG AA).
 */

/* ------------------------------------------------------------------ share */

/* An older footer.php: the X is absolutely placed top-right, so Share sits
   top-left. The redesigned footer puts both in a header row (modal.css). */
.product-detail-modal .ys-popup-share {
	position: absolute;
	top: 14px;
	left: 18px;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 44px;
	height: 44px;
	padding: 0 10px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #237A30;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.product-detail-modal .ys-popup-share[hidden] {
	display: none;
}

.product-detail-modal .ys-popup-share svg,
.ys-single .ys-page-share svg {
	width: 18px;
	height: 18px;
}

.product-detail-modal .ys-popup-share:hover,
.product-detail-modal .ys-popup-share:focus-visible {
	background: rgba(22, 27, 23, 0.06);
	outline: none;
}

.product-detail-modal .ys-popup-share:focus-visible {
	box-shadow: 0 0 0 2px #2E9E3D;
}

.product-detail-modal .ys-popup-toast {
	position: absolute;
	top: 16px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 6;
	padding: 8px 16px;
	border-radius: 999px;
	background: #161B17;
	color: #fff;
	font-size: 14px;
	line-height: 1.4;
	white-space: nowrap;
	box-shadow: 0 8px 20px -8px rgba(22, 27, 23, 0.45);
}

/* ------------------------------------------------------------------ icons */

.product-detail-modal .ys-popup-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	line-height: 0;
}

.product-detail-modal .ys-popup-icon svg {
	display: block;
	width: 18px;
	height: 18px;
}

/* --------------------------------------------------------------- contacts */

/*
 * Round 2 item 3: the seller's number is the last line of the CAPTION, at the
 * caption's own size, left-aligned, above the buttons (it was a bigger line
 * under the buttons). When the caption already ends with the number, that
 * number is the link and no line is added (CaptionNumber, listing-popup.js).
 * Tap to call; Copy only where there is a mouse (a computer), since a phone
 * already calls on tap.
 */
.product-detail-modal .ys-contact-number,
.ys-single .ys-contact-number {
	display: block;
	margin: 0;
	font: inherit;
	text-align: left;
}

/*
 * Round 2 item 3 follow-up (Oct 6): the number reads as part of the caption --
 * its size, weight and colour, not a bold green link -- with only a faint
 * underline so it still reads as tappable. Still tel: on tap.
 */
.product-detail-modal .ys-contact-number-link,
.ys-single .ys-contact-number-link {
	display: inline;
	color: inherit;
	font: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	text-decoration: underline;
	text-decoration-color: rgba(16, 48, 31, 0.3);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	white-space: nowrap;
}

.product-detail-modal .ys-contact-number-link:hover,
.ys-single .ys-contact-number-link:hover {
	color: inherit;
	text-decoration-color: currentColor;
}

.product-detail-modal .ys-contact-copy,
.ys-single .ys-contact-copy {
	display: none;
	margin-left: 8px;
	padding: 0 2px;
	border: 0;
	background: none;
	color: #1E6E2A;
	font: inherit;
	font-size: 0.85em;
	font-weight: 400;
	text-decoration: underline;
	cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
	.product-detail-modal .ys-contact-copy,
	.ys-single .ys-contact-copy {
		display: inline-block;
	}
}

.product-detail-modal .ys-contact-number-link:focus-visible,
.ys-single .ys-contact-number-link:focus-visible,
.product-detail-modal .ys-contact-copy:focus-visible,
.ys-single .ys-contact-copy:focus-visible {
	outline: 2px solid #2E9E3D;
	outline-offset: 2px;
}


/* The same buttons on the shared-link listing page (.ys-single, item 35). */

.product-detail-modal .ys-popup-contacts,
.ys-single .ys-popup-contacts {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 20px 0 0;
}

.product-detail-modal .ys-popup-contacts:empty,
.ys-single .ys-popup-contacts:empty {
	display: none;
}

.product-detail-modal .ys-popup-contacts .ys-contact-btn,
.ys-single .ys-popup-contacts .ys-contact-btn {
	display: inline-flex;
	flex: 1 1 0;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 96px;
	min-height: 48px;
	padding: 10px 16px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: #161B17;
	color: #fff;
	font-size: 15.5px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.01em;
	text-decoration: none;
	white-space: nowrap;
	box-shadow: 0 1px 2px rgba(22, 27, 23, 0.08), 0 4px 12px -6px rgba(22, 27, 23, 0.25);
	transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.product-detail-modal .ys-popup-contacts .ys-contact-btn:hover,
.ys-single .ys-popup-contacts .ys-contact-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(22, 27, 23, 0.1), 0 8px 18px -8px rgba(22, 27, 23, 0.35);
	color: #fff;
}

.product-detail-modal .ys-popup-contacts .ys-contact-btn:active,
.ys-single .ys-popup-contacts .ys-contact-btn:active {
	transform: none;
}

.product-detail-modal .ys-popup-contacts .ys-contact-btn:focus-visible,
.ys-single .ys-popup-contacts .ys-contact-btn:focus-visible {
	outline: 2px solid #2E9E3D;
	outline-offset: 2px;
}

/* WhatsApp: the brand green, ink text (white on #25D366 is under 2:1). */
.product-detail-modal .ys-popup-contacts .ys-contact-whatsapp,
.ys-single .ys-popup-contacts .ys-contact-whatsapp {
	background: #25D366;
	color: #0B2414;
}

.product-detail-modal .ys-popup-contacts .ys-contact-whatsapp:hover,
.ys-single .ys-popup-contacts .ys-contact-whatsapp:hover {
	background: #20C35D;
	color: #0B2414;
}

/*
 * Change list item 35: WhatsApp green, Call green, Text grey (the homepage
 * v50 prototype). Call is the brand green at its darker step, #25843A, so
 * white text clears WCAG AA (#2E9E3D with white is about 3.4:1); its hover
 * steps darker again. Text is the prototype's slate grey, white text 5.4:1.
 * A job's Email keeps the quiet outline.
 */
.product-detail-modal .ys-popup-contacts .ys-contact-call,
.ys-single .ys-popup-contacts .ys-contact-call {
	background: #25843A;
	color: #fff;
}

.product-detail-modal .ys-popup-contacts .ys-contact-call:hover,
.ys-single .ys-popup-contacts .ys-contact-call:hover {
	background: #1E6C30;
	color: #fff;
}

.product-detail-modal .ys-popup-contacts .ys-contact-text,
.ys-single .ys-popup-contacts .ys-contact-text {
	background: #5A6B7A;
	color: #fff;
}

.product-detail-modal .ys-popup-contacts .ys-contact-text:hover,
.ys-single .ys-popup-contacts .ys-contact-text:hover {
	background: #4A5966;
	color: #fff;
}

.product-detail-modal .ys-popup-contacts .ys-contact-email,
.ys-single .ys-popup-contacts .ys-contact-email {
	border-color: #D3DAD5;
	background: #fff;
	color: #161B17;
	box-shadow: 0 1px 2px rgba(22, 27, 23, 0.06);
}

.product-detail-modal .ys-popup-contacts .ys-contact-email:hover,
.ys-single .ys-popup-contacts .ys-contact-email:hover {
	border-color: #B9C3BC;
	background: #F6F8F7;
	color: #161B17;
}

/* An older footer.php's static "Use the posted contact information..." note
   says what the buttons now do; it steps aside only when buttons were drawn,
   so a legacy post (no buttons) keeps it. */
.product-detail-modal .ys-popup-contacts:not(:empty) ~ .product-modal-note {
	display: none;
}

/* ---------------------------------------------------------------- gallery */

/* An older footer.php: the photo box needs a positioning context for the
   arrows. The redesigned modal.css makes it sticky, which is one already. */
.product-detail-modal:not([data-ys-popup]) .product-modal-image {
	position: relative;
}

.product-detail-modal .ys-popup-gallery {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.product-detail-modal .ys-gallery-btn {
	position: absolute;
	top: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-top: -22px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #161B17;
	box-shadow: 0 2px 10px rgba(22, 27, 23, 0.18);
	cursor: pointer;
	pointer-events: auto;
	opacity: 0.92;
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.product-detail-modal .ys-gallery-btn:hover {
	opacity: 1;
	transform: scale(1.04);
}

.product-detail-modal .ys-gallery-btn:focus-visible {
	outline: 2px solid #2E9E3D;
	outline-offset: 2px;
	opacity: 1;
}

.product-detail-modal .ys-gallery-prev {
	left: 10px;
}

.product-detail-modal .ys-gallery-next {
	right: 10px;
}

.product-detail-modal .ys-gallery-btn .ys-popup-icon svg {
	width: 22px;
	height: 22px;
}

.product-detail-modal .ys-gallery-dots {
	position: absolute;
	left: 50%;
	bottom: 10px;
	display: flex;
	gap: 2px;
	padding: 2px 6px;
	border-radius: 999px;
	background: rgba(22, 27, 23, 0.35);
	transform: translateX(-50%);
	pointer-events: auto;
}

/* A 24px target around an 8px dot. */
.product-detail-modal .ys-gallery-dot {
	position: relative;
	width: 20px;
	height: 20px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.product-detail-modal .ys-gallery-dot::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 7px;
	height: 7px;
	margin: -3.5px 0 0 -3.5px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.6);
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.product-detail-modal .ys-gallery-dot[aria-current="true"]::after {
	background: #fff;
	transform: scale(1.25);
}

.product-detail-modal .ys-gallery-dot:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -2px;
	border-radius: 50%;
}

@media (hover: hover) {
	.product-detail-modal .ys-gallery-btn {
		opacity: 0;
	}

	.product-detail-modal .product-modal-image:hover .ys-gallery-btn,
	.product-detail-modal .ys-gallery-btn:focus-visible {
		opacity: 0.92;
	}
}

/* --------------------------------------------------------------- skeleton */

@keyframes ys-popup-shimmer {
	0% { background-position: 100% 0; }
	100% { background-position: -100% 0; }
}

.product-detail-modal .ys-skel {
	display: grid;
	gap: 10px;
	padding: 2px 0;
}

.product-detail-modal .ys-skel-line {
	background: linear-gradient(90deg, #EEF1EF 0%, #F7F9F8 40%, #EEF1EF 80%);
	background-size: 200% 100%;
	animation: ys-popup-shimmer 1.3s ease-in-out infinite;
}

/* The photo box shimmers only while it has no picture yet. Its own rule:
   a browser without :has() drops just this one. */
.product-detail-modal.ys-popup--loading .product-modal-image:has(> img[hidden]) {
	background: linear-gradient(90deg, #EEF1EF 0%, #F7F9F8 40%, #EEF1EF 80%);
	background-size: 200% 100%;
	animation: ys-popup-shimmer 1.3s ease-in-out infinite;
}

.product-detail-modal .ys-skel-line {
	display: block;
	height: 12px;
	border-radius: 6px;
}

.product-detail-modal .ys-skel-line:nth-child(2) {
	width: 92%;
}

.product-detail-modal .ys-skel-line:nth-child(3) {
	width: 64%;
}

/* No photo at all (not merely not loaded yet): a quiet placeholder. */
.product-detail-modal .product-modal-image.is-empty {
	background: #F3F5F4;
}

@media (prefers-reduced-motion: reduce) {
	.product-detail-modal .ys-skel-line {
		animation: none;
	}

	.product-detail-modal.ys-popup--loading .product-modal-image:has(> img[hidden]) {
		animation: none;
	}

	.product-detail-modal .ys-popup-contacts .ys-contact-btn,
	.product-detail-modal .ys-gallery-btn {
		transition: none;
	}
}

/* ------------------------------------------------------ more from seller */

/*
 * Change list item 35: "three small photos with prices" in one row of three,
 * as the homepage v50 prototype draws it -- no text line, no seller name.
 */
.product-detail-modal .ys-popup-seller,
.ys-single .ys-popup-seller {
	margin: 24px 0 0;
	padding-top: 16px;
	border-top: 1px solid #E6EAE7;
}

.product-detail-modal .ys-popup-seller[hidden] {
	display: none;
}

.product-detail-modal .ys-popup-seller h3,
.ys-single .ys-popup-seller h3 {
	margin: 0 0 8px;
	color: #6B7570;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.product-detail-modal .ys-popup-seller-grid,
.ys-single .ys-popup-seller-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.product-detail-modal .ys-seller-card,
.ys-single .ys-seller-card {
	display: block;
	min-width: 0;
	overflow: hidden;
	border: 1px solid #EEEEEE;
	border-radius: 10px;
	color: #161B17;
	text-decoration: none;
}

.product-detail-modal .ys-seller-card:hover .ys-seller-card-img img,
.ys-single .ys-seller-card:hover .ys-seller-card-img img {
	transform: scale(1.03);
}

.product-detail-modal .ys-seller-card:focus-visible,
.ys-single .ys-seller-card:focus-visible {
	outline: 2px solid #2E9E3D;
	outline-offset: 2px;
}

.product-detail-modal .ys-seller-card-img,
.ys-single .ys-seller-card-img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #F3F5F4;
}

.product-detail-modal .ys-seller-card-img img,
.ys-single .ys-seller-card-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.2s ease;
}

.product-detail-modal .ys-seller-card-price,
.ys-single .ys-seller-card-price {
	display: block;
	padding: 6px;
	color: #237A30;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.25;
}

/* An older answer may still carry a text line; item 35 shows none. */
.product-detail-modal .ys-seller-card-title {
	display: none;
}

/* -------------------------------------------------------------- sold report */

/*
 * Change list item 35, decision 1: "Is this item sold?" is a small grey text
 * link under the contact buttons, not a button, so the buttons stay the main
 * actions. sold-report.js keeps it hidden for the listing's first 48 hours.
 */
.product-detail-modal .ys-sold-report {
	display: inline-flex;
	margin: 10px 0 0;
	padding: 6px 0;
	min-height: 32px;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: #6B7570;
	font-size: 13px;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.product-detail-modal .ys-sold-report:hover:not(:disabled) {
	background: transparent;
	color: #161B17;
}

.product-detail-modal .ys-sold-report:disabled {
	color: #237A30;
	text-decoration: none;
}

/* ------------------------------------------------------- the listing page */

/*
 * single-ys_listing.php (change list items 5 and 35): Share at the top left.
 * The page's contact buttons and seller row reuse the popup's look above.
 */
.ys-single .ys-page-share {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 10px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: #237A30;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.ys-single .ys-page-share:hover {
	background: #EEF7EF;
}

.ys-single .ys-page-share:focus-visible {
	outline: 2px solid #2E9E3D;
	outline-offset: 2px;
}

.ys-single .ys-popup-toast {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 6;
	margin-top: 6px;
	padding: 8px 16px;
	border-radius: 999px;
	background: #161B17;
	color: #fff;
	font-size: 14px;
	line-height: 1.4;
	white-space: nowrap;
}

/* ---------------------------------------------------------------- auction */

/* Card 174: the purple badge beside the price (.ys-auction-badge's colours
   are in feed-card.css, which loads on every front-end page). */
.product-detail-modal .ys-popup-auction-badge {
	margin: 0 0 8px;
}

.product-detail-modal .ys-popup-auction-badge[hidden] {
	display: none;
}

/* Card 178: an auction has no contact buttons, and the theme's static "Use
   the posted contact information to reach out to the seller directly" is
   false for it -- contact details are exchanged only after the seller
   accepts a bid. */
.product-detail-modal.ys-popup--auction .product-modal-note {
	display: none;
}

/* ---------------------------------------------------------------- reduced */

/*
 * Round 2 item 4: for 7 days after a price drop, REDUCED at the top left of
 * the photo (white on orange #E07B00, as the owner's spec asks) and the
 * old price crossed out in grey beside the new one. The same on the
 * shared-link listing page.
 */
.product-detail-modal .ys-reduced-badge,
.ys-single .ys-reduced-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 3;
	padding: 3px 8px;
	border-radius: 4px;
	background: #E07B00;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.06em;
	pointer-events: none;
}

.ys-single .ys-single-image {
	position: relative;
}

.product-detail-modal .ys-price-was,
.ys-single .ys-price-was {
	margin-left: 8px;
	color: #6B6B70;
	font-size: 0.8em;
	font-weight: 400;
	text-decoration: line-through;
}
