/**
 * ResumeMastero — interactive components.
 *
 * Everything here animates with transform and opacity only, so the work stays
 * on the compositor. Each component degrades to a readable static state when
 * JavaScript is unavailable, and every motion is disabled under
 * prefers-reduced-motion at the end of this file.
 *
 * 1. Hero composition
 * 2. Before / after comparison
 * 3. ATS meters and score ring
 * 4. Bento grid
 * 5. Service cards
 * 6. Problem cards
 * 7. Testimonial rail
 * 8. Media panels
 * 9. Reduced motion
 *
 * @package ResumeMastero
 */

/* -------------------------------------------------------------------------
   1. Hero composition
   ---------------------------------------------------------------------- */

/*
 * The hero section clips its own overflow (the aurora needs it), so the stage
 * and its floating chips have to stay inside the column. The max-width leaves
 * room for the chips to overhang without being cut off.
 */
.rm-hero-stage {
	position: relative;
	max-width: 440px;
	margin-inline: auto;
}

.rm-hero-card {
	position: relative;
	border-radius: var(--rm-radius-lg);
	padding: 14px;
	background: var(--rm-glass-strong);
	border: 1px solid var(--rm-glass-line);
	backdrop-filter: blur(16px) saturate(150%);
	-webkit-backdrop-filter: blur(16px) saturate(150%);
	box-shadow: 0 40px 80px rgba(0, 0, 0, 0.4);
	line-height: 0;
}

.rm-hero-card img {
	width: 100%;
	height: auto;
	border-radius: calc(var(--rm-radius-lg) - 8px);
	display: block;
}

/* Small glass chips that hover off the corners of the hero mockup. */
.rm-float {
	position: absolute;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.7rem 0.95rem;
	border-radius: var(--rm-radius);
	background: rgba(14, 31, 26, 0.72);
	border: 1px solid var(--rm-glass-line);
	backdrop-filter: blur(16px) saturate(160%);
	-webkit-backdrop-filter: blur(16px) saturate(160%);
	box-shadow: 0 20px 44px rgba(0, 0, 0, 0.4);
	color: #fff;
	animation: rmFloatChip 6s ease-in-out infinite;
	will-change: transform;
}

.rm-float--tr {
	top: 7%;
	right: -7%;
	animation-delay: 0.4s;
}

.rm-float--bl {
	bottom: 11%;
	left: -9%;
	animation-delay: 1.4s;
}

@keyframes rmFloatChip {
	0%, 100% {
		transform: translate3d(0, 0, 0);
	}
	50% {
		transform: translate3d(0, -10px, 0);
	}
}

.rm-float__icon {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	flex: none;
	display: grid;
	place-items: center;
	background: var(--wp--preset--color--success);
}

.rm-float__icon svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: #fff;
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.rm-float__icon--accent {
	background: var(--wp--preset--color--accent);
}

.rm-float__text {
	line-height: 1.25;
	font-size: 0.8125rem;
	color: rgba(255, 255, 255, 0.72);
	white-space: nowrap;
}

.rm-float__text b {
	display: block;
	font-size: 0.95rem;
	font-weight: 700;
	color: #fff;
	font-family: var(--wp--preset--font-family--display);
}

@media (max-width: 1100px) {
	.rm-float--tr {
		right: -4%;
	}

	.rm-float--bl {
		left: -4%;
	}
}

@media (max-width: 781px) {
	.rm-float {
		display: none;
	}

	.rm-hero-stage {
		max-width: 400px;
	}
}

/* Avatar cluster used as a trust signal under the hero copy. */
.rm-faces {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	flex-wrap: wrap;
}

.rm-faces__stack {
	display: flex;
}

.rm-faces__stack span {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: 0.8rem;
	color: #fff;
	border: 2px solid var(--wp--preset--color--contrast);
	margin-left: -12px;
	transition: transform 0.3s var(--rm-ease);
}

.rm-faces__stack span:first-child {
	margin-left: 0;
}

.rm-faces__stack:hover span {
	transform: translateY(-3px);
}

/* -------------------------------------------------------------------------
   2. Before / after comparison
   ---------------------------------------------------------------------- */

.rm-compare {
	--rm-pos: 50%;
	position: relative;
	border-radius: var(--rm-radius-lg);
	overflow: hidden;
	box-shadow: 0 4px 10px rgba(14, 31, 26, 0.06), 0 34px 70px rgba(14, 31, 26, 0.16);
	background: var(--wp--preset--color--white);
	line-height: 0;
	isolation: isolate;
	touch-action: pan-y;
}

/* The "after" image is in normal flow and therefore sets the height. */
.rm-compare__base {
	display: block;
	width: 100%;
	height: auto;
}

.rm-compare__clip {
	position: absolute;
	inset: 0;
	clip-path: inset(0 calc(100% - var(--rm-pos)) 0 0);
	will-change: clip-path;
}

.rm-compare__clip img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top left;
}

.rm-compare__line {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--rm-pos);
	width: 2px;
	background: #fff;
	transform: translateX(-1px);
	box-shadow: 0 0 0 1px rgba(14, 31, 26, 0.16);
	pointer-events: none;
	z-index: 4;
}

.rm-compare__grip {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: #fff;
	display: grid;
	place-items: center;
	box-shadow: 0 8px 24px rgba(14, 31, 26, 0.3);
	transition: transform 0.25s var(--rm-ease);
}

.rm-compare__grip::before,
.rm-compare__grip::after {
	content: "";
	width: 0;
	height: 0;
	border-block: 6px solid transparent;
	position: absolute;
}

.rm-compare__grip::before {
	border-right: 8px solid var(--wp--preset--color--contrast);
	left: 12px;
}

.rm-compare__grip::after {
	border-left: 8px solid var(--wp--preset--color--contrast);
	right: 12px;
}

.rm-compare:hover .rm-compare__grip,
.rm-compare__range:focus-visible + .rm-compare__line .rm-compare__grip {
	transform: translate(-50%, -50%) scale(1.1);
}

.rm-compare__tag {
	position: absolute;
	top: 14px;
	z-index: 5;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 0.32rem 0.7rem;
	border-radius: var(--rm-radius-pill);
	line-height: 1.5;
	pointer-events: none;
	transition: opacity 0.25s;
}

.rm-compare__tag--before {
	left: 14px;
	background: rgba(14, 31, 26, 0.82);
	color: #fff;
}

.rm-compare__tag--after {
	right: 14px;
	background: var(--wp--preset--color--success);
	color: #fff;
}

/* The range input is the real control: invisible, full-bleed, and keyboard
   accessible for free. */
.rm-compare__range {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	opacity: 0;
	cursor: ew-resize;
	z-index: 6;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
}

.rm-compare__range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 56px;
	height: 100%;
	cursor: ew-resize;
}

.rm-compare__range::-moz-range-thumb {
	width: 56px;
	height: 100%;
	border: 0;
	cursor: ew-resize;
}

.rm-compare__hint {
	margin: 0.9rem 0 0;
	text-align: center;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--muted);
}

/* -------------------------------------------------------------------------
   3. ATS meters and score ring
   ---------------------------------------------------------------------- */

.rm-meters {
	display: grid;
	gap: 1.4rem;
}

.rm-meter {
	--rm-val: 0;
}

.rm-meter__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.5rem;
}

.rm-meter__label {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.rm-meter__num {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--wp--preset--color--accent);
}

.rm-on-dark .rm-meter__num {
	color: var(--wp--preset--color--accent-2);
}

.rm-meter__track {
	height: 9px;
	border-radius: var(--rm-radius-pill);
	background: var(--wp--preset--color--base-2);
	overflow: hidden;
}

.rm-on-dark .rm-meter__track {
	background: rgba(255, 255, 255, 0.11);
}

.rm-meter__fill {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--wp--preset--color--accent), var(--wp--preset--color--accent-2));
	transform: scaleX(var(--rm-val));
	transform-origin: 0 50%;
	transition: transform 1.25s var(--rm-ease);
	will-change: transform;
}

.rm-meter--good .rm-meter__fill {
	background: linear-gradient(90deg, #1f8a5b, var(--wp--preset--color--success));
}

/* Circular score */
.rm-ring {
	--rm-val: 0;
	position: relative;
	width: 132px;
	height: 132px;
	flex: none;
}

.rm-ring svg {
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}

.rm-ring__track {
	fill: none;
	stroke: var(--wp--preset--color--base-2);
	stroke-width: 10;
}

.rm-on-dark .rm-ring__track {
	stroke: rgba(255, 255, 255, 0.12);
}

.rm-ring__bar {
	fill: none;
	stroke: url(#rmRingGradient);
	stroke-width: 10;
	stroke-linecap: round;
	stroke-dasharray: 339.3;
	stroke-dashoffset: calc(339.3 - (339.3 * var(--rm-val)));
	transition: stroke-dashoffset 1.4s var(--rm-ease);
}

.rm-ring__value {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.65rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.rm-illustrative {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.75rem;
	line-height: 1.4;
	color: var(--wp--preset--color--muted);
	border: 1px dashed var(--rm-line);
	border-radius: var(--rm-radius-sm);
	padding: 0.45rem 0.7rem;
}

.rm-on-dark .rm-illustrative {
	color: rgba(255, 255, 255, 0.62);
	border-color: var(--rm-glass-line);
}

/* -------------------------------------------------------------------------
   4. Bento grid
   ---------------------------------------------------------------------- */

.rm-bento {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: repeat(6, 1fr);
}

.rm-bento > * {
	grid-column: span 6;
	min-width: 0;
}

@media (min-width: 700px) {
	.rm-bento > * {
		grid-column: span 3;
	}

	.rm-bento > .rm-bento--wide {
		grid-column: span 6;
	}
}

@media (min-width: 1000px) {
	.rm-bento > * {
		grid-column: span 2;
	}

	.rm-bento > .rm-bento--wide {
		grid-column: span 4;
	}

	.rm-bento > .rm-bento--tall {
		grid-row: span 2;
	}
}

/* -------------------------------------------------------------------------
   5. Service cards
   ---------------------------------------------------------------------- */

.rm-service {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	height: 100%;
	padding: 1.9rem;
	border: 1px solid var(--rm-line);
	border-radius: var(--rm-radius-lg);
	background: var(--wp--preset--color--white);
	overflow: hidden;
	transition: transform var(--rm-dur) var(--rm-ease), box-shadow var(--rm-dur) var(--rm-ease), border-color var(--rm-dur);
}

/* A soft accent bloom that grows from the corner on hover. */
.rm-service::after {
	content: "";
	position: absolute;
	top: -40%;
	right: -30%;
	width: 70%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(192, 95, 53, 0.16), rgba(192, 95, 53, 0) 70%);
	opacity: 0;
	transform: scale(0.6);
	transition: opacity 0.45s, transform 0.55s var(--rm-ease);
	pointer-events: none;
}

.rm-service:hover,
.rm-service:focus-within {
	transform: translateY(-7px);
	border-color: rgba(192, 95, 53, 0.36);
	box-shadow: 0 4px 10px rgba(14, 31, 26, 0.05), 0 30px 60px rgba(14, 31, 26, 0.13);
}

.rm-service:hover::after,
.rm-service:focus-within::after {
	opacity: 1;
	transform: scale(1);
}

.rm-service > * {
	position: relative;
	z-index: 1;
}

.rm-service__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

.rm-service__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.3;
	/* Reserve two lines so prices and descriptions align across a row even
	   when one service name wraps and its neighbours do not. */
	min-height: 2.6em;
	display: flex;
	align-items: flex-end;
}

@media (max-width: 599px) {
	.rm-service__title {
		min-height: 0;
		display: block;
	}
}

.rm-service__price {
	margin: 0;
	font-weight: 700;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--accent);
}

.rm-service__desc {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--contrast-2);
	line-height: 1.6;
}

.rm-service__link {
	margin-top: auto;
	padding-top: 0.35rem;
	font-size: var(--wp--preset--font-size--small);
}

/* Make the whole card clickable without nesting interactive elements. */
.rm-service__link a::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	border-radius: inherit;
}

/* -------------------------------------------------------------------------
   6. Problem cards
   ---------------------------------------------------------------------- */

.rm-problem {
	display: flex;
	gap: 1rem;
	padding: 1.4rem;
	border-radius: var(--rm-radius);
	background: var(--wp--preset--color--white);
	border: 1px solid var(--rm-line);
	transition: transform var(--rm-dur) var(--rm-ease), box-shadow var(--rm-dur);
}

.rm-problem:hover {
	transform: translateX(5px);
	box-shadow: 0 14px 34px rgba(14, 31, 26, 0.08);
}

.rm-problem__mark {
	flex: none;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: rgba(176, 62, 62, 0.11);
	color: #b03e3e;
	font-weight: 700;
	font-size: 1.1rem;
	line-height: 1;
}

.rm-problem h3 {
	margin: 0 0 0.3rem;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.35;
}

.rm-problem p {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--contrast-2);
	line-height: 1.6;
}

/* -------------------------------------------------------------------------
   7. Testimonial rail
   ---------------------------------------------------------------------- */

.rm-rail-wrap {
	position: relative;
}

/*
 * Fade the card the rail cuts off at its right edge, so a partially visible
 * card reads as "there is more to scroll" rather than as a layout mistake.
 */
@media (min-width: 782px) {
	.rm-rail-wrap::after {
		content: "";
		position: absolute;
		top: 0;
		right: 0;
		bottom: 4.5rem;
		width: 5rem;
		pointer-events: none;
		background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--wp--preset--color--white));
	}
}

.rm-rail {
	display: flex;
	align-items: stretch;
	gap: 1.5rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding: 0.5rem 0 1.5rem;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

/* Bleed to the screen edge on small screens only, so the rail reads as
   swipeable there without looking like an accidental overflow on desktop. */
@media (max-width: 781px) {
	.rm-rail {
		margin-inline: calc(var(--wp--preset--spacing--30) * -1);
		padding-inline: var(--wp--preset--spacing--30);
	}
}

.rm-rail::-webkit-scrollbar {
	display: none;
}

.rm-rail > * {
	flex: 0 0 min(28rem, 84vw);
	scroll-snap-align: start;
}

.rm-rail-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	margin-top: 0.5rem;
}

.rm-rail-btn {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 1px solid var(--rm-line);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--contrast);
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: all 0.25s var(--rm-ease);
}

.rm-rail-btn:hover:not(:disabled) {
	background: var(--wp--preset--color--contrast);
	border-color: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	transform: translateY(-2px);
}

.rm-rail-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.rm-rail-btn svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.rm-rail-progress {
	flex: 1 1 auto;
	max-width: 180px;
	height: 3px;
	border-radius: var(--rm-radius-pill);
	background: var(--rm-line);
	overflow: hidden;
}

.rm-rail-progress span {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: var(--wp--preset--color--accent);
	transform: scaleX(var(--rm-rail-pos, 0.3));
	transform-origin: 0 50%;
	transition: transform 0.25s var(--rm-ease-soft);
}

/* -------------------------------------------------------------------------
   8. Media panels
   ---------------------------------------------------------------------- */

/* Full-bleed photo band with an ink scrim, used behind closing CTAs. */
.rm-media-band {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	background-color: var(--wp--preset--color--contrast);
}

.rm-media-band__bg {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: saturate(0.55) contrast(1.05);
}

.rm-media-band::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		linear-gradient(105deg, rgba(14, 31, 26, 0.95) 12%, rgba(14, 31, 26, 0.78) 48%, rgba(14, 31, 26, 0.62) 100%),
		radial-gradient(60% 60% at 18% 20%, rgba(192, 95, 53, 0.3), rgba(192, 95, 53, 0) 70%);
}

/* Photo with a stat chip anchored to it. */
.rm-media-figure {
	position: relative;
}

.rm-media-figure__chip {
	position: absolute;
	right: -10px;
	bottom: -18px;
	z-index: 2;
	padding: 1rem 1.2rem;
	border-radius: var(--rm-radius);
	background: var(--wp--preset--color--white);
	border: 1px solid var(--rm-line);
	box-shadow: 0 20px 46px rgba(14, 31, 26, 0.16);
	max-width: 15rem;
}

.rm-media-figure__chip b {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.5rem;
	line-height: 1.1;
	color: var(--wp--preset--color--contrast);
}

.rm-media-figure__chip span {
	font-size: 0.8rem;
	color: var(--wp--preset--color--muted);
	line-height: 1.4;
	display: block;
	margin-top: 0.2rem;
}

@media (max-width: 599px) {
	.rm-media-figure__chip {
		right: 8px;
		bottom: -14px;
		padding: 0.8rem 1rem;
	}

	.rm-media-figure__chip b {
		font-size: 1.25rem;
	}
}

/* -------------------------------------------------------------------------
   9. Reduced motion
   ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.rm-float,
	.rm-hero-stage {
		animation: none !important;
	}

	.rm-meter__fill {
		transition: none !important;
	}

	.rm-ring__bar {
		transition: none !important;
	}

	.rm-rail {
		scroll-behavior: auto;
	}

	.rm-service:hover,
	.rm-problem:hover,
	.rm-rail-btn:hover {
		transform: none !important;
	}

	.rm-service::after {
		display: none;
	}
}
