/* Services cards: on hover a short light runs round the card's frame, the same "shiny border"
   used on the SunColour site, in this site's colours: dark grey (#292929) and red (#fb4848):
   transparent -> dark grey -> red core -> dark grey -> transparent, over more than half of the frame,
   on a dark grey frame.
   Browsers without @property support keep the theme's normal static red frame. */

@property --svc-angle {
	syntax: "<angle>";
	initial-value: 0deg;
	inherits: false;
}

@keyframes svc-spin {
	to { --svc-angle: 360deg; }
}

@supports (mask-composite: exclude) or (-webkit-mask-composite: xor) {

	.services-area .single-service-item .img-holder .overlay::after {
		content: "";
		position: absolute;
		inset: 0;
		border-radius: 12px;
		padding: 4px;                       /* thickness of the light frame */
		background:
			conic-gradient(from var(--svc-angle),
				rgba(41, 41, 41, 0), #292929 14%, #fb4848 35%, #292929 56%, rgba(41, 41, 41, 0) 70%),
			rgba(41, 41, 41, 0.55);         /* dark grey frame under the running light */
		background:
			conic-gradient(in oklab from var(--svc-angle),
				rgba(41, 41, 41, 0), rgba(41, 41, 41, 0.7) 7%, #292929 14%, #c62f2f 24%, #fb4848 31%, #fb4848 39%,
				#c62f2f 46%, #292929 56%, rgba(41, 41, 41, 0.7) 63%, rgba(41, 41, 41, 0) 70%),
			rgba(41, 41, 41, 0.55);
		-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
		-webkit-mask-composite: xor;
		mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
		opacity: 0;
		transition: opacity 0.4s ease;
		pointer-events: none;
		z-index: 2;
	}

	.services-area .single-service-item:hover .img-holder .overlay::after {
		opacity: 1;
		animation: svc-spin 5s linear infinite;
	}

	/* the old static border is replaced by the light frame */
	.services-area .single-service-item:hover .img-holder .overlay .box {
		border-color: transparent !important;
	}
}

/* Visitors who turn off motion get a still frame */
@media (prefers-reduced-motion: reduce) {
	.services-area .single-service-item:hover .img-holder .overlay::after {
		animation: none;
	}
}

/* ---------------------------------------------------------------------------
   Homepage services section only (.rp-services-home) on a dark background (#29292B).
   Inner pages also use .services-area as their wrapper, so they keep their normal light look.
   Titles turn light, card icons get a dark box with a light icon (red on hover).
   The body text under each card (#9e9e9e) already reads well on dark, so it stays.
   --------------------------------------------------------------------------- */
.services-area.rp-services-home {
	background-color: #29292B;
}

/* section heading: small line + main title */
.services-area.rp-services-home .sec-title p {
	color: #c9c9cd;
}
.services-area.rp-services-home .sec-title h1 {
	color: #ffffff;
}
.services-area.rp-services-home .sec-title h1 .highlight-red {
	color: #fb4848;
}

/* card titles */
.services-area.rp-services-home .single-service-item .text-holder .text h3,
.services-area.rp-services-home .single-service-item .text-holder .text h3 a {
	color: #ffffff;
}

/* card icons: dark box with a light icon, red on hover (as before) */
.services-area.rp-services-home .single-service-item .text-holder .icon {
	background: #38383c;
	color: #f2f2f2;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.services-area.rp-services-home .single-service-item:hover .text-holder .icon {
	background: #fb4848;
	color: #ffffff;
	box-shadow: none;
}

/* -------------------------------------------------------------------------
   Card text: summary + key-service chips + "details" link (modules/functions/services.tpl)
   ------------------------------------------------------------------------- */
.rp-svc .text h3 a { color: inherit; text-decoration: none; transition: color .25s; }
.rp-svc .text h3 a:hover { color: #fb4848; }
.rp-svc-body img, .rp-svc-body a.highslide { display: none; }      /* same picture as the card image */
.rp-svc-body .svc-sum { margin: 0 0 14px; font-family: 'IranSans', sans-serif; font-size: 14px; line-height: 2; color: #6b6b70; }
/* key services: a tidy two-column list with small red ticks (no boxes) */
.rp-svc-body .svc-tags {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 9px 16px;
	margin: 0 0 22px;
	padding: 16px 0 0;
	border-top: 1px solid rgba(41, 41, 43, 0.1);
	list-style: none;
}
.rp-svc-body .svc-tags li {
	position: relative;
	margin: 0;
	padding: 0 18px 0 0;
	font-family: 'IranSans', sans-serif;
	font-size: 13px;
	line-height: 1.7;
	color: #3a3a3e;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color .3s;
}
.rp-svc-body .svc-tags li::before {
	content: "";
	position: absolute;
	top: 50%;
	right: 2px;
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-radius: 50%;
	background: #fb4848;
	box-shadow: 0 0 6px rgba(251, 72, 72, 0.6);
}
/* card layout: the button sits at the bottom of every card, so all buttons line up */
.rp-svc { display: flex; flex-direction: column; height: 100%; transition: transform .45s cubic-bezier(.22,1,.36,1); }
.rp-svc .text-holder { flex: 1 1 auto; display: flex; flex-direction: column; }
.rp-svc .text-holder .text { flex: 1 1 auto; display: flex; flex-direction: column; }
.rp-svc-body { flex: 1 1 auto; }
.rp-services-home .row { display: flex; flex-wrap: wrap; }
.rp-services-home .row::before, .rp-services-home .row::after { display: none; }
.rp-services-home .row > [class*="col-"] { float: none; margin-bottom: 34px; }
.rp-svc:hover { transform: translateY(-6px); }

/* "details" button: the SunColour-style running light (same as the card frame) runs round
   its border while the card is hovered; the arrow slides out and back in. */
.rp-svc-btn {
	position: relative;
	isolation: isolate;
	align-self: stretch;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	height: 50px;
	padding: 0 20px 0 6px;
	border-radius: 14px;
	background: rgba(41, 41, 43, 0.05);
	font-family: 'IranSansMedium', 'IranSans', sans-serif;
	font-size: 14px;
	color: #29292B !important;
	text-decoration: none !important;
	transition: background-color .4s, color .4s;
}
.rp-svc-btn { box-shadow: inset 0 0 0 1px rgba(41, 41, 43, 0.14); }      /* thin static frame */
/* card hovered: the running red light goes round the button frame (as before) */
.rp-svc-btn::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	border-radius: inherit;
	padding: 1.5px;
	background: conic-gradient(from var(--svc-angle), rgba(41, 41, 41, 0), #292929 14%, #c62f2f 24%, #fb4848 31%, #fb4848 39%, #c62f2f 46%, #292929 56%, rgba(41, 41, 41, 0) 70%);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
	opacity: 0;
	transition: opacity .4s;
	pointer-events: none;
}
.rp-svc:hover .rp-svc-btn::before { opacity: 1; animation: svc-spin 3.5s linear infinite; }
/* button itself hovered: the fill effect takes over, the light steps back */
.rp-svc .rp-svc-btn:hover::before, .rp-svc .rp-svc-btn:focus-visible::before { opacity: 0; }
/* hover, after the SunColour "Read more" button (dle20 css/sc-fan.css, .sx-btn):
   the red square grows to fill the whole button, the label slides out and a white label with an arrow slides in. */
.rp-svc-btn { overflow: hidden; }
.rp-svc-btn-fill {
	position: absolute;
	z-index: -1;
	left: 6px;
	top: 6px;
	width: 38px;
	height: 38px;
	border-radius: 11px;
	background: #fb4848;
	transition: all .3s cubic-bezier(.4, 0, .2, 1);
}
.rp-svc-btn:hover .rp-svc-btn-fill, .rp-svc-btn:focus-visible .rp-svc-btn-fill {
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	border-radius: 14px;
	transform: scale(1.8);
}
.rp-svc-btn::after {
	content: attr(data-t) "  \2190";
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	white-space: pre;
	opacity: 0;
	transform: translateX(48px);
	transition: transform .3s cubic-bezier(.4, 0, .2, 1), opacity .3s;
}
.rp-svc-btn:hover::after, .rp-svc-btn:focus-visible::after { transform: translateX(4px); opacity: 1; }
.rp-svc-btn-text, .rp-svc-btn-ico { transition: transform .3s cubic-bezier(.4, 0, .2, 1), opacity .3s; }
.rp-svc-btn:hover .rp-svc-btn-text, .rp-svc-btn:focus-visible .rp-svc-btn-text { transform: translateX(-48px); opacity: 0; }
.rp-svc-btn:hover .rp-svc-btn-ico, .rp-svc-btn:focus-visible .rp-svc-btn-ico { opacity: 0; }
.rp-svc-btn-text { padding-right: 2px; }
.rp-svc-btn-ico {
	position: relative;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 11px;
	background: #fb4848;
	color: #fff;
	font-size: 14px;
	overflow: hidden;
	transition: box-shadow .4s;
}
.rp-svc-btn-ico i { display: block; }
.rp-svc-btn:focus-visible { outline: none; }
.services-area.rp-services-home .rp-svc-btn { color: #fff !important; background: rgba(255, 255, 255, 0.05); }
.services-area.rp-services-home .rp-svc-btn { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
@media (prefers-reduced-motion: reduce) {
	.rp-svc-btn-fill, .rp-svc-btn::after, .rp-svc-btn-text, .rp-svc-btn-ico { transition: none; }
	.rp-svc:hover .rp-svc-btn::before { animation: none; }
}

/* icon box: flips round and turns red, the glyph pops */
.services-area .rp-svc .text-holder .icon {
	transform-style: preserve-3d;
	transition: transform .7s cubic-bezier(.22,1,.36,1), background-color .4s, color .4s, box-shadow .4s;
}
.services-area .rp-svc .text-holder .icon i { display: inline-block; transition: transform .5s cubic-bezier(.34,1.56,.64,1); }
.services-area .rp-svc:hover .text-holder .icon {
	transform: rotateY(360deg);
	background: #fb4848 !important;
	color: #fff !important;
	box-shadow: 0 14px 28px -12px rgba(251, 72, 72, 0.8);
}
.services-area .rp-svc:hover .text-holder .icon i { transform: scale(1.12); }
@media (prefers-reduced-motion: reduce) {
	.rp-svc, .rp-svc:hover, .services-area .rp-svc:hover .text-holder .icon { transform: none; }
}

/* dark home section */
.services-area.rp-services-home .rp-svc-body .svc-sum { color: rgba(255, 255, 255, 0.68); }
.services-area.rp-services-home .rp-svc-body .svc-tags { border-top-color: rgba(255, 255, 255, 0.1); }
.services-area.rp-services-home .rp-svc-body .svc-tags li { color: rgba(255, 255, 255, 0.82); }
.services-area.rp-services-home .rp-svc .text h3 a:hover { color: #fb4848; }

/* the theme fixed card paragraphs at 140px; the summary sizes itself, aligned to 3 lines on wide screens */
.services-area .single-service-item .text-holder .text .rp-svc-body p.svc-sum { height: auto; overflow: visible; }
@media (min-width: 768px) {
	.services-area .single-service-item .text-holder .text .rp-svc-body p.svc-sum { min-height: 84px; }
	.rp-svc-body .svc-tags { align-content: start; }
}

/* -------------------------------------------------------------------------
   Compact service cards: a full row of three fits one laptop screen (~600px per card instead of 753px).
   Wide 16:10 image, icon sits on the image's lower edge, tighter text and list. Button unchanged.
   ------------------------------------------------------------------------- */
.services-area .rp-svc { padding-bottom: 0; }
.services-area .rp-svc .img-holder { height: auto; aspect-ratio: 16 / 10; }
.services-area .rp-svc .img-holder img { height: 100%; object-fit: cover; }
.services-area .rp-svc .text-holder { padding-top: 34px; }
.services-area .rp-svc .text-holder .icon {
	top: -24px;
	right: 18px;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border-radius: 14px;
	font-size: 22px;
	box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.services-area .rp-svc .text-holder .icon i { font-size: 22px; line-height: 1; }
.services-area .rp-svc .text-holder .text h3 { height: auto; margin: 0 0 8px; overflow: visible; font-size: 19px; line-height: 1.5; }
.services-area .single-service-item .text-holder .text .rp-svc-body p.svc-sum { margin-bottom: 12px; font-size: 13.5px; line-height: 1.95; }
@media (min-width: 768px) {
	.services-area .single-service-item .text-holder .text .rp-svc-body p.svc-sum { min-height: 53px; }
}
.rp-svc-body .svc-tags { gap: 4px 14px; margin-bottom: 16px; padding-top: 12px; }
.rp-svc-body .svc-tags li { font-size: 12.5px; line-height: 1.75; }
.rp-svc-btn { height: 46px; }
.rp-svc-btn-ico, .rp-svc-btn-fill { width: 34px; height: 34px; border-radius: 10px; }
.rp-svc-btn-fill { top: 6px; left: 6px; }
.rp-services-home .row > [class*="col-"] { margin-bottom: 30px; }

/* =========================================================================
   Home service cards on screens with a mouse (768px+): the photo fills the card; title, two-line summary
   and button stay visible on a glass panel; the key-services list slides up on hover while the photo frame
   shrinks to the free space above the panel. Class .rp-svc-mix is on the section in main.tpl.
   Phones and touch tablets use the compact stacked card above (no hover there).
   ========================================================================= */
@media (hover: hover) and (min-width: 768px) {
	.rp-svc-mix .rp-svc {
		position: relative;
		height: 460px;
		border-radius: 14px;
		overflow: hidden;
		background: #1d1d1f;
	}
	.rp-svc-mix .rp-svc .img-holder { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; border-radius: 14px; }
	.rp-svc-mix .rp-svc .img-holder img { height: 100%; border-radius: 14px; }
	.rp-svc-mix .rp-svc .text-holder {
		position: absolute;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 3;
		padding: 70px 22px 20px;
		text-align: right;
		background: linear-gradient(0deg, rgba(20, 20, 22, 0.97) 0%, rgba(20, 20, 22, 0.92) 58%, rgba(20, 20, 22, 0) 100%);
	}
	.rp-svc-mix .rp-svc .text-holder .icon { top: 18px; right: 22px; }
	.rp-svc-mix .rp-svc .text-holder .text h3 { margin: 0 0 8px; }
	.rp-svc-mix .single-service-item .text-holder .text .rp-svc-body p.svc-sum { min-height: 0; margin-bottom: 14px; color: rgba(255, 255, 255, 0.78); }
	/* only the list is folded away */
	.rp-svc-mix .rp-svc-body .svc-tags {
		max-height: 0;
		margin: 0;
		padding-top: 0;
		border-top-color: transparent;
		opacity: 0;
		overflow: hidden;
		transform: translateY(10px);
		transition: max-height .55s cubic-bezier(.22,1,.36,1), opacity .4s ease, transform .55s cubic-bezier(.22,1,.36,1), padding .55s, margin .55s, border-color .4s;
	}
	.rp-svc-mix .rp-svc:hover .rp-svc-body .svc-tags,
	.rp-svc-mix .rp-svc:focus-within .rp-svc-body .svc-tags {
		max-height: 120px;
		margin-bottom: 16px;
		padding-top: 12px;
		border-top-color: rgba(255, 255, 255, 0.12);
		opacity: 1;
		transform: none;
	}
	.rp-svc-mix .rp-svc:hover { transform: translateY(-6px); }
}

/* Option 3: keep the photo readable while the list opens.
   1) the text sits on a glass panel with a crisp top edge, instead of a tall dark fade over the photo;
   2) on hover the photo frame shrinks to the space above the opened panel, so the whole picture stays in view.
      --panel-h is the opened panel height, measured by js/site-ui.js. */
@media (hover: hover) and (min-width: 768px) {
	.rp-svc-mix .rp-svc .text-holder {
		padding: 30px 22px 20px;
		background: rgba(22, 22, 24, 0.82);
		-webkit-backdrop-filter: blur(14px) saturate(1.2);
		backdrop-filter: blur(14px) saturate(1.2);
		border-top: 1px solid rgba(255, 255, 255, 0.1);
		border-radius: 0 0 14px 14px;
	}
	.rp-svc-mix .rp-svc .text-holder .icon { top: -24px; }
	/* on hover the photo frame shrinks to the free area above the panel and re-centres the picture there */
	.rp-svc-mix .rp-svc .img-holder { height: auto; bottom: 0; transition: bottom .55s cubic-bezier(.22,1,.36,1); }
	.rp-svc-mix .rp-svc:hover .img-holder, .rp-svc-mix .rp-svc:focus-within .img-holder { bottom: var(--panel-h, 230px); border-radius: 14px 14px 0 0; }
	.rp-svc-mix .rp-svc .img-holder img { transform: none; }
	.rp-svc-mix .rp-svc:hover .img-holder img { transform: scale(1.04); }
}

/* glass panel: lighter tint so the photo shows through the frosted glass.
   The card's own background is the same photo (--svc-bg, set by js/site-ui.js), so the glass still
   shows it after the photo frame shrinks on hover. */
@media (hover: hover) and (min-width: 768px) {
	.rp-svc-mix .rp-svc { background: #1d1d1f var(--svc-bg, none) center / cover no-repeat; }
	.rp-svc-mix .rp-svc .text-holder {
		background: linear-gradient(180deg, rgba(22, 22, 24, 0.42) 0%, rgba(22, 22, 24, 0.62) 100%);
		-webkit-backdrop-filter: blur(12px) saturate(1.35);
		backdrop-filter: blur(12px) saturate(1.35);
		border-top: 1px solid rgba(255, 255, 255, 0.16);
		box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
	}
	.rp-svc-mix .rp-svc .text-holder .text h3 a,
	.rp-svc-mix .single-service-item .text-holder .text .rp-svc-body p.svc-sum,
	.rp-svc-mix .rp-svc-body .svc-tags li { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55); }
}

/* photo framing: the photo never sits under the panel. Its frame always ends at the panel's top edge
   (closed: --panel-closed, open on hover: --panel-h, both measured by js/site-ui.js), and the picture is
   centred on its subject (the big word: SEO, PHOTO, DECOR ...), which sits a little below the image centre. */
@media (hover: hover) and (min-width: 768px) {
	.rp-svc-mix .rp-svc .img-holder { bottom: var(--panel-closed, 210px); border-radius: 14px 14px 0 0; }
	.rp-svc-mix .rp-svc .img-holder img { object-fit: cover; object-position: 50% 62%; }
}
/* list open (smaller frame): aim a bit higher so tall words like PHOTO keep their tops */
@media (hover: hover) and (min-width: 768px) {
	.rp-svc-mix .rp-svc:hover .img-holder img, .rp-svc-mix .rp-svc:focus-within .img-holder img { object-position: 50% 47%; }
	.rp-svc-mix .rp-svc .img-holder img { transition: transform .5s ease, filter .5s ease, object-position .55s cubic-bezier(.22,1,.36,1); }
}

/* glass backdrop follows the photo: grey and dark at rest, in colour on hover (like the photo itself) */
@media (hover: hover) and (min-width: 768px) {
	.rp-svc-mix .rp-svc { background: #1d1d1f; }
	.rp-svc-mix .rp-svc::before {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 0;
		background: var(--svc-bg, none) center / cover no-repeat;
		filter: grayscale(1) brightness(.75);
		transition: filter .5s ease;
		pointer-events: none;
	}
	.rp-svc-mix .rp-svc:hover::before, .rp-svc-mix .rp-svc:focus-within::before { filter: none; }
	.rp-svc-mix .rp-svc .img-holder { z-index: 1; }
	.rp-svc-mix .rp-svc .text-holder { background: linear-gradient(180deg, rgba(20, 20, 22, 0.5) 0%, rgba(20, 20, 22, 0.7) 100%); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
	.rp-svc-mix .rp-svc:hover .text-holder, .rp-svc-mix .rp-svc:focus-within .text-holder { -webkit-backdrop-filter: blur(12px) saturate(1.35); backdrop-filter: blur(12px) saturate(1.35); }
}

/* /services/ list page: same section as the homepage + an intro line under the H1 */
.rp-svc-list .sec-title h1.rp-h1 { font-family: "IranSansBold", "IranSans", sans-serif; font-size: clamp(26px, 2.6vw, 34px); line-height: 1.5; margin-top: 4px; }
.rp-svc-list-lead { max-width: 820px; margin: -10px 0 40px; font-size: 15px; line-height: 2.05; color: rgba(255, 255, 255, .66); direction: rtl; }
