/* ==========================================================================
   Design refresh: cards and steps.
   Loaded on the site (after refresh.css) AND in the block editor, so what the
   client edits looks like what visitors see.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Icons (for "Как работим" steps and capability cards).
   Picked in the editor: column → Стилове → "Икона: …" (is-style-gs-icon-*),
   or written by the content script (gs-ico-*).
   -------------------------------------------------------------------------- */

.is-style-gs-icon-chat,
.gs-ico-chat { --gs-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3Cpath d='M8 9h8M8 13h5'/%3E%3C/svg%3E"); }
.is-style-gs-icon-demo,
.gs-ico-demo { --gs-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='14' rx='2'/%3E%3Cpath d='M8 21h8M12 17v4'/%3E%3Cpath d='m10 7 5 3-5 3z'/%3E%3C/svg%3E"); }
.is-style-gs-icon-install,
.gs-ico-install { --gs-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5'/%3E%3Cpath d='M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2'/%3E%3C/svg%3E"); }
.is-style-gs-icon-training,
.gs-ico-training { --gs-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 10 12 5 2 10l10 5 10-5z'/%3E%3Cpath d='M6 12v5c3 2 9 2 12 0v-5M22 10v6'/%3E%3C/svg%3E"); }
.is-style-gs-icon-support,
.gs-ico-support { --gs-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='m4.9 4.9 4.3 4.3M14.8 14.8l4.3 4.3M14.8 9.2l4.3-4.3M4.9 19.1l4.3-4.3'/%3E%3C/svg%3E"); }

/* --------------------------------------------------------------------------
   "Как работим": steps in one row joined by a dotted line.
   Works with any number of columns: every column of the block is a step (also
   ones the client adds), numbers are automatic, 2–6 steps share one row,
   7 or more wrap into rows of four.
   -------------------------------------------------------------------------- */

.gs-steps.wp-block-columns {
	--gs-n: 5;
	--gs-step-gap: clamp(1rem, 2vw, 1.75rem);
	position: relative;
	display: grid !important;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	gap: var(--gs-step-gap);
	counter-reset: gs-step;
}

.gs-steps:has(> .wp-block-column:nth-child(2):last-child) { --gs-n: 2; }
.gs-steps:has(> .wp-block-column:nth-child(3):last-child) { --gs-n: 3; }
.gs-steps:has(> .wp-block-column:nth-child(4):last-child) { --gs-n: 4; }
.gs-steps:has(> .wp-block-column:nth-child(6):last-child) { --gs-n: 6; }

/* dotted line from the first icon to the last one */
.gs-steps::before {
	content: "";
	position: absolute;
	top: 1.75rem;
	right: calc((100% - (var(--gs-n) - 1) * var(--gs-step-gap)) / (2 * var(--gs-n)));
	left: calc((100% - (var(--gs-n) - 1) * var(--gs-step-gap)) / (2 * var(--gs-n)));
	height: 2px;
	background: repeating-linear-gradient(90deg, #b9d3ef 0 8px, transparent 8px 14px);
	pointer-events: none;
}

.gs-steps:has(> .wp-block-column:nth-child(7)) {
	grid-auto-flow: row;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	row-gap: 2.5rem;
}

.gs-steps:has(> .wp-block-column:nth-child(7))::before {
	display: none;
}

/* default icon (a tick) for a step without a chosen icon; :where() keeps it weaker than the icon classes */
:where(.gs-steps > .wp-block-column) {
	--gs-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.gs-steps > .wp-block-column {
	position: relative;
	min-width: 0;
	text-align: center;
	counter-increment: gs-step;
}

/* icon circle (the white ring hides the dotted line behind it) */
.gs-steps > .wp-block-column::before,
.gs-steps > .wp-block-column::after {
	content: "";
	display: block;
	width: 3.5rem;
	height: 3.5rem;
}

.gs-steps > .wp-block-column::before {
	margin: 0 auto 1rem;
	border: 2px solid #cfe0f3;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 0 0 8px #fff, 0 6px 16px rgba(5, 105, 205, 0.12);
	transition: background var(--gs-dur) var(--gs-ease-out), border-color var(--gs-dur) var(--gs-ease-out);
}

.gs-steps > .wp-block-column::after {
	position: absolute;
	top: 0;
	left: 50%;
	background: var(--gs-brand);
	-webkit-mask: var(--gs-ico) center / 1.45rem no-repeat;
	mask: var(--gs-ico) center / 1.45rem no-repeat;
	translate: -50% 0;
	transition: background var(--gs-dur) var(--gs-ease-out);
}

.gs-steps > .wp-block-column:hover::before {
	border-color: var(--gs-brand);
	background: var(--gs-brand);
}

.gs-steps > .wp-block-column:hover::after {
	background: #fff;
}

.gs-steps > .wp-block-column > h3 {
	margin: 0 0 0.4rem;
	font-size: 1.05rem;
}

/* step number above the title: 01, 02, … */
.gs-steps > .wp-block-column > h3:first-child::before {
	content: counter(gs-step, decimal-leading-zero);
	display: block;
	margin-bottom: 0.3rem;
	color: var(--gs-brand);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.1em;
}

.gs-steps > .wp-block-column > p {
	margin: 0;
	color: var(--gs-muted);
	font-size: 0.93rem;
	line-height: 1.5;
}

@media (max-width: 960px) {
	.gs-steps.wp-block-columns,
	.gs-steps.wp-block-columns:has(> .wp-block-column:nth-child(7)) {
		grid-auto-flow: row;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		row-gap: 2rem;
	}

	.gs-steps::before {
		display: none;
	}
}

/* phones: a vertical list, icon on the left */
@media (max-width: 600px) {
	.gs-steps.wp-block-columns,
	.gs-steps.wp-block-columns:has(> .wp-block-column:nth-child(7)) {
		grid-template-columns: 1fr;
		row-gap: 1.5rem;
	}

	.gs-steps > .wp-block-column {
		display: grid;
		grid-template-columns: 3.5rem 1fr;
		column-gap: 1rem;
		text-align: left;
	}

	.gs-steps > .wp-block-column::before {
		grid-row: 1 / span 9;
		margin: 0;
	}

	.gs-steps > .wp-block-column::after {
		left: 0;
		translate: none;
	}
}

/* --------------------------------------------------------------------------
   Side cards: product "Накратко" + demo, company card on the About page
   -------------------------------------------------------------------------- */

.gs-side-card {
	padding: 1.5rem;
	border: 1px solid var(--gs-line);
	border-radius: 18px;
	background: linear-gradient(180deg, #f6f9fe 0%, #fff 45%);
	box-shadow: var(--gs-shadow);
}

.gs-side-card .gs-side-card__title {
	margin: 0 0 0.9rem;
	color: var(--gs-navy);
	font-size: 1.05rem;
	line-height: 1.3;
	letter-spacing: 0;
}

.gs-checklist {
	display: grid;
	gap: 0.6rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gs-checklist li {
	display: grid;
	grid-template-columns: 22px 1fr;
	gap: 0.6rem;
	align-items: start;
	margin: 0;
	color: var(--gs-text);
	font-size: 0.95rem;
	line-height: 1.4;
}

.gs-checklist .gs-icon {
	width: 22px;
	height: 22px;
	padding: 4px;
	border-radius: 50%;
	background: #e3f6e8;
	color: #16a34a;
	stroke-width: 3;
}

.gs-side-card__demo {
	display: grid;
	gap: 0.6rem;
}

.gs-checklist + .gs-side-card__demo {
	margin-top: 1.4rem;
	padding-top: 1.4rem;
	border-top: 1px solid var(--gs-line);
}

.gs-side-card__demo .gs-side-card__title {
	margin-bottom: 0;
}

.gs-side-card__demo p {
	margin: 0 0 0.4rem;
	color: var(--gs-muted);
	font-size: 0.95rem;
	line-height: 1.5;
}

.gs-btn--block {
	justify-content: center;
	width: 100%;
}

.gs-btn .gs-icon {
	width: 18px;
	height: 18px;
}

.gs-btn--soft {
	background: var(--gs-light);
	color: var(--gs-brand);
}

.gs-btn--soft:hover {
	background: #dceaf8;
	color: var(--gs-brand-dark);
	box-shadow: none;
}

/* company facts (About page) */
.gs-facts {
	display: grid;
	gap: 0.9rem;
	margin: 0;
}

.gs-facts > div {
	display: grid;
	gap: 0.2rem;
	padding-bottom: 0.9rem;
	border-bottom: 1px dashed var(--gs-line);
}

.gs-facts dt {
	color: var(--gs-muted);
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.gs-facts dd {
	margin: 0;
	color: var(--gs-navy);
	font-size: 0.97rem;
	font-weight: 500;
	line-height: 1.45;
}

.gs-facts dd ul {
	display: grid;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gs-facts dd li {
	margin: 0;
}

.gs-facts dd a {
	color: var(--gs-brand);
	font-weight: 600;
	text-decoration: none;
}

.gs-facts dd a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.gs-side-card__link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: 1rem;
	color: var(--gs-brand);
	font-weight: 600;
	text-decoration: none;
}

.gs-side-card__link .gs-icon {
	width: 16px;
	height: 16px;
	transition: translate var(--gs-dur) var(--gs-ease-out);
}

.gs-side-card__link:hover .gs-icon {
	translate: 3px 0;
}
