/**
 * The anchor line on the storefront.
 *
 * WHY A TYPOGRAPHY RESET AND NOT JUST SPACING
 *
 * The line is appended inside WooCommerce's own price element, so without a
 * reset it inherits `p.price` — which in most themes is large and bold. The
 * anchor would then compete with the price it is meant to be compared against.
 * Font size and weight are therefore set explicitly, and only on our own
 * elements. There is deliberately no `!important` and no list of page-builder
 * selectors: a theme that wants to restyle this should be able to.
 */

.r2sc-anchor,
.r2sc-lowest {
	display: block;
	position: relative;
	margin-top: 0.4em;
	font-size: 12px;
	font-weight: 400;
	font-style: normal;
	line-height: 1.4;
	text-decoration: none;
	color: inherit;
	opacity: 0.85;
}

.r2sc-anchor__label,
.r2sc-anchor__sep,
.r2sc-anchor__amount,
.r2sc-lowest__label,
.r2sc-lowest__sep,
.r2sc-lowest__amount {
	display: inline;
}

.r2sc-anchor__amount,
.r2sc-lowest__amount {
	white-space: nowrap;
}

/* The 30-day line sits between the sale price and the anchor; a hair less
 * space above it keeps the three amounts reading as one group. */
.r2sc-lowest + .r2sc-anchor {
	margin-top: 0.2em;
}

/* ── Tooltip ─────────────────────────────────────────────────────────
 * CSS only. Shown on hover and on keyboard focus; the bubble itself is
 * referenced by aria-describedby, so assistive tech reads the price first and
 * the explanation second, rather than the explanation instead of the price.
 */

.r2sc-anchor--has-tip {
	cursor: help;
}

.r2sc-anchor--has-tip .r2sc-anchor__label {
	text-decoration: underline dotted;
	text-underline-offset: 0.2em;
}

.r2sc-anchor__tip {
	position: absolute;
	left: 0;
	bottom: calc(100% + 0.5em);
	z-index: 30;
	width: min(300px, 78vw);
	padding: 0.7em 0.85em;
	border-radius: 6px;
	background: #1d2327;
	color: #fff;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.45;
	text-align: left;
	text-decoration: none;
	white-space: pre-line; /* Croatian and English explanations, one after the other */
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	pointer-events: none;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.r2sc-anchor__tip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 1.1em;
	border: 6px solid transparent;
	border-top-color: #1d2327;
}

.r2sc-anchor--has-tip:hover .r2sc-anchor__tip,
.r2sc-anchor--has-tip:focus .r2sc-anchor__tip,
.r2sc-anchor--has-tip:focus-within .r2sc-anchor__tip {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.r2sc-anchor--has-tip:focus {
	outline: none;
}

.r2sc-anchor--has-tip:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* Near the viewport edge the bubble would otherwise overflow to the right. */
@media (max-width: 480px) {
	.r2sc-anchor__tip {
		width: min(300px, 90vw);
	}
}

/* ── RISE2 rem scale ─────────────────────────────────────────────────
 * On RISE2 themes 1rem = 100 design px (html { font-size: calc(100vw / 14.4) },
 * 375 frame on a portrait phone), so every size below is design px ÷ 100 and
 * the tooltip scales with the page instead of staying fixed. `.r2sc-rem` is a
 * body class when the setting says rem, or set on <html> by the detector.
 * Both price lines and the tooltip use 0.12rem (12 design px).
 */
.r2sc-rem .r2sc-anchor,
.r2sc-rem .r2sc-lowest {
	font-size: 0.12rem;
}

.r2sc-rem .r2sc-anchor__tip {
	bottom: calc(100% + 0.08rem);
	width: 3rem;
	padding: 0.1rem 0.12rem;
	border-radius: 0.08rem;
	font-size: 0.12rem;
	transform: translateY(0.04rem);
	box-shadow: 0 0.06rem 0.18rem rgba(0, 0, 0, 0.18);
}

.r2sc-rem .r2sc-anchor__tip::after {
	left: 0.16rem;
	border-width: 0.06rem;
}

.r2sc-rem .r2sc-anchor--has-tip .r2sc-anchor__label {
	text-underline-offset: 0.03rem;
}

@media screen and (max-width: 768px) and (orientation: portrait) {
	.r2sc-rem .r2sc-anchor__tip {
		width: 2.8rem;
		padding: 0.1rem 0.12rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.r2sc-anchor__tip {
		transition: none;
	}
}

/* ── Admin view mode ─────────────────────────────────────────────────
 * Printed only for a shop manager, on a line customers cannot see yet.
 */
.r2sc-is-preview {
	outline: 1px dashed rgba(178, 98, 0, 0.55);
	outline-offset: 2px;
}

.r2sc-preview-tag {
	display: inline-block;
	margin-left: 0.5em;
	padding: 0 0.45em;
	border-radius: 3px;
	background: #b26200;
	color: #fff;
	font-size: 0.72em;
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	vertical-align: middle;
}

/* The render number a manager asked for ("Označi ispise cijene"). Blue, so it
 * is never mistaken for the amber PREGLED tag: it says which render this is,
 * not what customers see. */
.r2sc-render-tag {
	display: inline-block;
	margin: 0.3em 0 0 0.5em;
	padding: 0 0.5em;
	border-radius: 3px;
	background: #2271b1;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	font-style: normal;
	line-height: 1.7;
	letter-spacing: 0.02em;
	text-decoration: none;
	vertical-align: middle;
	white-space: nowrap;
}
