/**
 * GIREM portal — mega menu & homepage card system (v3.1).
 */

.girem-portal-grid {
	display: grid;
	gap: 14px;
}

.girem-portal-grid--catalog {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.girem-portal-grid--actions {
	grid-template-columns: 1fr;
	gap: 10px;
}

.girem-portal-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #e8eaf0;
	border-radius: 12px;
	padding: 14px;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
	position: relative;
	overflow: hidden;
	min-height: 232px;
}

.girem-portal-card__hit {
	display: flex;
	flex-direction: column;
	flex: 1;
	text-decoration: none;
	color: inherit;
}

.girem-portal-card__sublinks {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid #eef0f5;
}

.girem-portal-card__sublinks a {
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	color: #40465a;
	text-decoration: none;
	background: #f6f7fa;
	border-radius: 999px;
	padding: 5px 10px;
	transition: background 0.15s ease, color 0.15s ease;
}

.girem-portal-card__sublinks a:hover,
.girem-portal-card__sublinks a:focus-visible {
	background: rgba(73, 51, 209, 0.1);
	color: #4933d1;
}

.girem-portal-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: #4933d1;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.girem-portal-card:hover,
.girem-portal-card:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 12px 32px rgba(73, 51, 209, 0.12);
	border-color: rgba(73, 51, 209, 0.25);
}

.girem-portal-card:hover::before,
.girem-portal-card:focus-visible::before {
	opacity: 1;
}

.girem-portal-card__media {
	display: block;
	height: 120px;
	border-radius: 8px;
	overflow: hidden;
	background: #f6f7fa;
	margin-bottom: 12px;
}

.girem-portal-card__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	padding: 10px;
	display: block;
}

.girem-portal-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1;
}

.girem-portal-card__title {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
	color: #0f172a;
}

.girem-portal-card__desc {
	font-size: 12px;
	line-height: 1.35;
	color: #64748b;
}

.girem-portal-card__cta {
	margin-top: auto;
	font-size: 13px;
	font-weight: 600;
	color: #4933d1;
}

/* Action cards */
.girem-portal-card--action {
	min-height: 0;
	padding: 14px 14px 14px 56px;
}

.girem-portal-card--blue { background: #f0f4ff; }
.girem-portal-card--violet { background: #f5f3ff; }
.girem-portal-card--warm { background: #fff8f0; }
.girem-portal-card--neutral { background: #f6f7fa; }

.girem-portal-card__icon {
	position: absolute;
	left: 14px;
	top: 14px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #fff;
	border: 1px solid rgba(73, 51, 209, 0.12);
}

.girem-portal-card__icon--shield::after,
.girem-portal-card__icon--swap::after,
.girem-portal-card__icon--doc::after,
.girem-portal-card__icon--grid::after {
	content: "";
	position: absolute;
	inset: 9px;
	background: #4933d1;
	mask-size: contain;
	mask-repeat: no-repeat;
	mask-position: center;
	-webkit-mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-position: center;
}

.girem-portal-card__icon--shield::after {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V5l8-3z'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V5l8-3z'/%3E%3C/svg%3E");
}

.girem-portal-card__icon--swap::after {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 7h12l-3-3 1.4-1.4L22.8 8l-5.4 5.4L16 12l3-3H7V7zm10 10H5l3 3-1.4 1.4L1.2 16l5.4-5.4L8 12l-3 3h12v2z'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 7h12l-3-3 1.4-1.4L22.8 8l-5.4 5.4L16 12l3-3H7V7zm10 10H5l3 3-1.4 1.4L1.2 16l5.4-5.4L8 12l-3 3h12v2z'/%3E%3C/svg%3E");
}

.girem-portal-card__icon--doc::after {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 2h9l5 5v15a1 1 0 01-1 1H6a1 1 0 01-1-1V3a1 1 0 011-1zm8 1.5V8h4.5'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 2h9l5 5v15a1 1 0 01-1 1H6a1 1 0 01-1-1V3a1 1 0 011-1zm8 1.5V8h4.5'/%3E%3C/svg%3E");
}

.girem-portal-card__icon--grid::after {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h7v7H4V4zm9 0h7v7h-7V4zM4 13h7v7H4v-7zm9 0h7v7h-7v-7z'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h7v7H4V4zm9 0h7v7h-7V4zM4 13h7v7H4v-7zm9 0h7v7h-7v-7z'/%3E%3C/svg%3E");
}

.girem-portal-card--action .girem-portal-card__title {
	font-size: 14px;
}

/* Mega panel */
.giremrus-site-nav__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px;
}

.giremrus-site-nav__item > a,
.giremrus-site-nav__trigger {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 8px 8px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	color: inherit;
	background: none;
	border: 0;
	cursor: pointer;
	font-family: inherit;
	white-space: nowrap;
}

.giremrus-site-nav__trigger[aria-expanded="true"] {
	color: #4933d1;
}

.giremrus-site-nav__caret {
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	opacity: 0.7;
}

.girem-mega[hidden] {
	display: none !important;
}

.girem-mega {
	position: fixed;
	inset: 0;
	z-index: 99990;
}

.girem-mega.is-open {
	display: block;
}

.girem-mega__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.32);
}

.girem-mega__panel {
	position: absolute;
	left: 50%;
	top: 72px;
	transform: translateX(-50%);
	width: min(960px, calc(100vw - 32px));
	max-height: calc(100vh - 96px);
	overflow: auto;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
	border: 1px solid #e8eaf0;
	animation: girem-mega-in 0.2s ease-out;
}

@keyframes girem-mega-in {
	from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
	to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.girem-mega__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: #f6f7fa;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
}

.girem-mega__body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 220px;
	gap: 20px;
	padding: 20px 20px 12px;
}

.girem-mega__brands {
	margin: 4px 0 0;
	font-size: 13px;
}

.girem-mega__brands a {
	color: #64748b;
	text-decoration: none;
}

.girem-mega__brands a:hover {
	color: #4933d1;
	text-decoration: underline;
}

.girem-mega__footer {
	padding: 10px 20px 14px;
	border-top: 1px solid #e8eaf0;
	background: #f8f9fc;
	border-radius: 0 0 14px 14px;
}

.girem-mega__footer p {
	margin: 0;
	font-size: 12px;
	color: #64748b;
	text-align: center;
}

body.girem-mega-open {
	overflow: hidden;
}

.girem-code-header__nav-trigger,
.girem-code-mobile-nav__trigger {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-weight: 600;
	color: inherit;
	cursor: pointer;
}

/* Homepage section using portal cards */
.girem-portal-section {
	padding: 48px 0;
}

.girem-portal-section__head {
	margin-bottom: 20px;
}

.girem-portal-section__title {
	margin: 0 0 8px;
	font-size: 28px;
	font-weight: 700;
	color: #0f172a;
}

.girem-portal-section__lead {
	margin: 0;
	font-size: 15px;
	color: #64748b;
	max-width: 52ch;
}

.girem-portal-section .girem-portal-grid--catalog {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1024px) {
	.girem-mega__body {
		grid-template-columns: 1fr;
	}

	.girem-portal-grid--catalog,
	.girem-portal-section .girem-portal-grid--catalog {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.girem-portal-grid--actions {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.girem-mega__panel {
		top: 0;
		left: 0;
		right: 0;
		transform: none;
		width: 100%;
		max-height: 100vh;
		border-radius: 0;
		animation: none;
	}

	.girem-portal-grid--catalog,
	.girem-portal-section .girem-portal-grid--catalog,
	.girem-portal-grid--actions {
		grid-template-columns: 1fr;
	}

	.girem-portal-card {
		min-height: 0;
	}
}

/* Trust strip — shared mega menu & homepage */
.girem-portal-trust {
	margin-top: 20px;
	padding: 10px 16px;
	border: 1px solid #e8eaf0;
	border-radius: 10px;
	background: #f8f9fc;
	text-align: center;
}

.girem-portal-trust p {
	margin: 0;
	font-size: 12px;
	color: #64748b;
}

.girem-portal-grid--actions-home {
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
}

@media (max-width: 1024px) {
	.girem-portal-grid--actions-home {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.girem-portal-grid--actions-home {
		grid-template-columns: 1fr;
	}
}

/* Homepage harmonization — align legacy b2b blocks with portal cards */
.girem-b2b-demo .girem-b2b-demo__section-head h2,
.girem-b2b-demo .girem-b2b-demo__shild-copy h2,
.girem-b2b-demo .girem-b2b-demo__hero-copy h1 {
	color: #0f172a;
	letter-spacing: -0.02em;
}

.girem-b2b-demo .girem-b2b-demo__section-head h2 {
	font-size: 28px;
	font-weight: 700;
	line-height: 1.15;
}

.girem-b2b-demo .girem-b2b-demo__eyebrow {
	background: #f0f4ff;
	color: #4933d1;
	border-radius: 999px;
	letter-spacing: 0.08em;
}

.girem-b2b-demo .girem-b2b-demo__button {
	min-height: 48px;
	padding: 0 20px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
}

.girem-b2b-demo .girem-b2b-demo__button--primary {
	background: #4933d1;
	border-color: #4933d1;
	box-shadow: 0 8px 20px rgba(73, 51, 209, 0.2);
}

.girem-b2b-demo .girem-b2b-demo__button--primary:hover,
.girem-b2b-demo .girem-b2b-demo__button--primary:focus {
	background: #3d2bb8;
	border-color: #3d2bb8;
}

.girem-b2b-demo .girem-b2b-demo__button--secondary,
.girem-b2b-demo .girem-b2b-demo__button--ghost {
	background: #fff;
	border-color: #e8eaf0;
	color: #0f172a !important;
}

.girem-b2b-demo .girem-b2b-demo__button--secondary:hover,
.girem-b2b-demo .girem-b2b-demo__button--secondary:focus,
.girem-b2b-demo .girem-b2b-demo__button--ghost:hover,
.girem-b2b-demo .girem-b2b-demo__button--ghost:focus {
	background: #f0f4ff;
	border-color: rgba(73, 51, 209, 0.25);
	color: #4933d1 !important;
}

.girem-b2b-demo .girem-b2b-demo__why-card,
.girem-b2b-demo .girem-b2b-demo__task-card,
.girem-b2b-demo .girem-b2b-demo__case-card,
.girem-b2b-demo .girem-b2b-demo__step-card,
.girem-b2b-demo .girem-b2b-demo__panel,
.girem-b2b-demo .girem-b2b-demo__proof-card {
	border: 1px solid #e8eaf0;
	border-radius: 12px;
	box-shadow: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.girem-b2b-demo .girem-b2b-demo__why-card:hover,
.girem-b2b-demo .girem-b2b-demo__task-card:hover,
.girem-b2b-demo .girem-b2b-demo__case-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 32px rgba(73, 51, 209, 0.1);
	border-color: rgba(73, 51, 209, 0.22);
}

.girem-b2b-demo .girem-b2b-demo__why-copy h3 {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
}

.girem-b2b-demo .girem-b2b-demo__why-copy p,
.girem-b2b-demo .girem-b2b-demo__task-card p {
	font-size: 12px;
	line-height: 1.35;
	color: #64748b;
}

.girem-b2b-demo .girem-b2b-demo__section-link {
	color: #4933d1;
	font-weight: 600;
	font-size: 14px;
}

.girem-b2b-demo .girem-b2b-demo__chasto-ishut-link {
	border: 1px solid #e8eaf0;
	border-radius: 10px;
	background: #fff;
	font-size: 13px;
	font-weight: 600;
	transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.girem-b2b-demo .girem-b2b-demo__chasto-ishut-link:hover {
	transform: translateY(-2px);
	border-color: rgba(73, 51, 209, 0.25);
	box-shadow: 0 8px 20px rgba(73, 51, 209, 0.08);
	color: #4933d1;
}

.girem-b2b-demo .girem-b2b-demo__stats-bar {
	border-top: 1px solid #e8eaf0;
	border-bottom: 1px solid #e8eaf0;
	background: #f8f9fc;
}

.girem-b2b-demo .girem-b2b-demo__stats-item strong {
	color: #4933d1;
}
