/*
 * WordPress-specific additions.
 *
 * Everything visual comes from main.css. Only the things that exist because the
 * site now runs on WordPress live here: the admin-bar offset, editor content
 * typography, block alignment and the archive pagination.
 */

/* Keep the fixed header clear of the WordPress admin bar. */
body.admin-bar .sr-header {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .sr-header {
		top: 46px;
	}
}

/* Content coming out of the block editor. */
.sr-prose > * + * {
	margin-top: 1rem;
}

.sr-prose h2 {
	margin-top: 2rem;
	font-size: 1.5rem;
}

.sr-prose h3 {
	margin-top: 1.5rem;
	font-size: 1.2rem;
}

.sr-prose ul,
.sr-prose ol {
	padding-inline-start: 1.6rem;
	list-style: disc;
}

.sr-prose ol {
	list-style: decimal;
}

.sr-prose li + li {
	margin-top: .4rem;
}

.sr-prose a {
	color: var(--sr-primary, #0045a0);
	text-decoration: underline;
}

.sr-prose blockquote {
	margin: 1.5rem 0;
	padding: 1rem 1.25rem;
	border-inline-start: 4px solid var(--sr-primary, #0045a0);
	background: #f4f7fb;
	border-radius: 10px;
}

.sr-prose img,
.sr-prose iframe {
	max-width: 100%;
	height: auto;
	border-radius: 12px;
}

.sr-prose table {
	width: 100%;
	border-collapse: collapse;
}

.sr-prose th,
.sr-prose td {
	padding: .6rem .75rem;
	border: 1px solid #e3e8f0;
	text-align: start;
}

.sr-prose th {
	background: #f4f7fb;
}

/* Block editor alignment. */
.sr-prose .alignwide {
	margin-inline: calc(-1 * clamp(0px, 4vw, 60px));
	max-width: none;
}

.sr-prose .aligncenter {
	margin-inline: auto;
	display: block;
}

.sr-prose .alignleft {
	float: left;
	margin: 0 0 1rem 1.25rem;
}

.sr-prose .alignright {
	float: right;
	margin: 0 1.25rem 1rem 0;
}

.sr-prose .wp-block-button__link {
	display: inline-block;
}

/* Archive pagination (WordPress markup, site styling). */
.pagination,
.nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	justify-content: center;
	align-items: center;
	margin-top: 1.5rem;
}

.pagination .page-numbers,
.nav-links .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	min-height: 42px;
	padding: 0 .7rem;
	border: 1px solid #dfe6f0;
	border-radius: 10px;
	background: #fff;
	color: #1d2733;
	text-decoration: none;
	font-weight: 600;
}

.pagination .page-numbers.current,
.nav-links .page-numbers.current {
	background: var(--sr-primary, #0045a0);
	border-color: var(--sr-primary, #0045a0);
	color: #fff;
}

/* Card thumbnails reused inside the archive grid. */
.sr-card .sr-post-card__thumb {
	display: block;
	margin: -.25rem 0 .75rem;
	border-radius: 12px;
	overflow: hidden;
}

.sr-card .sr-post-card__thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

/* -------------------------------------------------------------------------
 * Full-width page template ("صفحه تمام‌عرض").
 *
 * Content authored in the editor is rendered as-is, so the block wrappers
 * WordPress adds must not introduce extra spacing or width limits.
 * ---------------------------------------------------------------------- */

.sr-page-content > .wp-block-group {
	margin-block: 0;
	padding: 0;
}

.sr-page-content .wp-block-group.sr-section,
.sr-page-content .wp-block-group.sr-section--surface,
.sr-page-content .wp-block-group.sr-section--primary,
.sr-page-content .wp-block-group.sr-section--tint,
.sr-page-content .wp-block-group.sr-section--tight {
	margin-block: 0;
}

.sr-page-content .wp-block-group__inner-container > * + * {
	margin-top: 1rem;
}

.sr-page-content .wp-block-group.sr-section > .wp-block-group__inner-container,
.sr-page-content .wp-block-group.sr-section--surface > .wp-block-group__inner-container,
.sr-page-content .wp-block-group.sr-section--primary > .wp-block-group__inner-container,
.sr-page-content .wp-block-group.sr-section--tint > .wp-block-group__inner-container {
	max-width: 1200px;
	margin-inline: auto;
	padding-inline: clamp(16px, 4vw, 32px);
}

.sr-page-content .wp-block-columns {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	margin-bottom: 0;
}

.sr-page-content .wp-block-column {
	flex: 1 1 240px;
	min-width: 0;
}

.sr-page-content .wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: .75rem;
}

.sr-page-content .wp-block-button__link {
	display: inline-block;
}

.sr-page-content h1,
.sr-page-content h2,
.sr-page-content h3 {
	margin-block: 0;
}

.sr-page-content .sr-section__head > * + * {
	margin-top: .75rem;
}

/* Cards used as links inside editor content keep the card look. */
.sr-page-content a.sr-card {
	color: inherit;
	text-decoration: none;
}

.sr-page-content a.sr-card:hover {
	color: inherit;
}

/* Success state for lead forms (the theme only ships the warning variant). */
.sr-notice--ok {
	border-color: #b7e4c7;
	background: #eefbf2;
	color: #14663a;
}

/* Two column layout for a form plus its side panel. */
.sr-form-layout {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: 2rem;
	align-items: start;
	margin-top: 1.5rem;
}

.sr-form-layout .sr-side-box {
	position: sticky;
	top: calc(var(--sr-header-h, 72px) + 16px);
}

@media (max-width: 900px) {
	.sr-form-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.sr-form-layout .sr-side-box {
		position: static;
	}
}

/* Radio and checkbox groups inside a form field. */
.sr-checks--plain {
	display: flex;
	flex-direction: column;
	gap: .55rem;
	padding-top: .25rem;
}

/* Code sample block. */
.sr-code {
	margin: 1.25rem 0;
	padding: 1rem 1.15rem;
	border-radius: 12px;
	background: #0d1b2a;
	color: #e6edf5;
	direction: ltr;
	text-align: left;
	overflow-x: auto;
	font-size: .85rem;
	line-height: 1.75;
}

.sr-code pre {
	margin: 0;
}

.sr-code code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	white-space: pre;
}

/* Large screenshot on a single project page. */
.sr-project-shot {
	margin: 0 0 1.75rem;
	border: 1px solid var(--sr-border);
	border-radius: var(--sr-radius);
	overflow: hidden;
	background: #fff;
	box-shadow: var(--sr-shadow-lg);
}

.sr-project-shot img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

/* -------------------------------------------------------------------------
 * Blog (WordPress only pieces)
 * ---------------------------------------------------------------------- */

.sr-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.sr-search {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 16px;
	background: #fff;
	border: 1px solid var(--sr-border);
	border-radius: var(--sr-radius);
	box-shadow: var(--sr-shadow);
}

.sr-search__input {
	flex: 1 1 240px;
	min-height: 46px;
	padding: 0 14px;
	border: 1px solid var(--sr-border);
	border-radius: var(--sr-radius-sm);
	background: var(--sr-surface);
	font: inherit;
	color: var(--sr-text);
}

.sr-search__input:focus {
	border-color: var(--sr-primary);
	outline: 0;
	box-shadow: 0 0 0 3px var(--sr-primary-050);
}

.sr-side-box--cta {
	background: linear-gradient(160deg, var(--sr-primary) 0%, var(--sr-primary-dark, #002f6c) 100%);
	border-color: transparent;
	color: #fff;
}

.sr-side-box--cta h3 {
	color: #fff;
	border-bottom-color: rgba(255, 255, 255, .22);
}

.sr-side-box--cta .sr-muted { color: rgba(255, 255, 255, .82); }
.sr-side-box--cta p { font-size: .88rem; margin-bottom: 14px; }

/* Comments */
.sr-comments {
	margin-top: 40px;
	padding-top: 28px;
	border-top: 1px solid var(--sr-border);
}

.sr-comments__title {
	margin: 0 0 18px;
	font-size: 1.15rem;
}

.sr-comment-list,
.sr-comment-list .children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sr-comment-list .children {
	margin-inline-start: 26px;
	padding-inline-start: 16px;
	border-inline-start: 2px solid var(--sr-border);
}

.sr-comment-list .comment-body {
	margin-bottom: 18px;
	padding: 16px 18px;
	background: var(--sr-surface);
	border: 1px solid var(--sr-border);
	border-radius: var(--sr-radius);
	font-size: .92rem;
}

.sr-comment-list .comment-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-bottom: 8px;
	color: var(--sr-muted);
	font-size: .82rem;
}

.sr-comment-list .comment-author img {
	margin-inline-end: 8px;
	border-radius: 50%;
}

.sr-comment-list .comment-author .fn {
	font-weight: 600;
	font-style: normal;
	color: var(--sr-text);
}

.sr-comment-list .reply a {
	font-size: .82rem;
	color: var(--sr-primary);
}

.comment-respond .form-submit { margin-top: 12px; }

.comment-respond .comment-form-cookies-consent {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: .84rem;
	color: var(--sr-muted);
}

.comment-respond .comment-reply-title small {
	font-size: .72rem;
	font-weight: 400;
}

.comment-respond .form-submit .submit {
	min-height: 46px;
	padding: 0 26px;
}

/* Pagination also renders outside .sr-pager on archives. */
.sr-pager .page-numbers {
	min-width: 40px;
	padding: 8px 12px;
	border: 1px solid var(--sr-border);
	border-radius: var(--sr-radius-sm);
	background: #fff;
	color: var(--sr-text);
	font-size: .9rem;
	text-align: center;
	text-decoration: none;
}

.sr-pager .page-numbers:hover { border-color: var(--sr-primary); color: var(--sr-primary); }

.sr-pager .page-numbers.current {
	border-color: var(--sr-primary);
	background: var(--sr-primary);
	color: #fff;
}

.sr-pager .page-numbers.dots {
	border-color: transparent;
	background: transparent;
}

.sr-pager .sr-pager__item.dots {
	border-color: transparent;
	background: transparent;
}

/* Two cards per row on tablets; one per row below 560px. */
@media (min-width: 561px) and (max-width: 900px) {
	.sr-blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* -------------------------------------------------------------------------
 * Free consultation popup
 * ---------------------------------------------------------------------- */

.sr-modal {
	position: fixed;
	inset: 0;
	z-index: 9998;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.sr-modal[hidden] { display: none !important; }

.sr-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(3, 15, 34, .62);
	backdrop-filter: blur(3px);
	animation: sr-modal-fade .2s ease both;
}

.sr-modal__dialog {
	position: relative;
	width: min(560px, 100%);
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 28px;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 30px 70px rgba(3, 15, 34, .38);
	animation: sr-modal-rise .26s cubic-bezier(.22, .68, .38, 1) both;
}

.sr-modal__close {
	position: absolute;
	top: 14px;
	left: 14px;
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--sr-border);
	border-radius: 50%;
	background: #fff;
	color: var(--sr-muted);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.sr-modal__close:hover {
	background: var(--sr-primary-050);
	border-color: var(--sr-primary);
	color: var(--sr-primary);
}

.sr-modal__head { text-align: center; margin-bottom: 20px; }

.sr-modal__head h3 {
	margin: 8px 0 8px;
	font-size: 1.32rem;
}

.sr-modal__head p {
	margin: 0;
	color: var(--sr-muted);
	font-size: .88rem;
	line-height: 1.9;
}

.sr-modal__form { display: flex; flex-direction: column; }

.sr-modal__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.sr-modal__actions .sr-btn { width: 100%; }

.sr-modal__actions .sr-btn[disabled] {
	opacity: .5;
	cursor: not-allowed;
	transform: none;
}

.sr-modal__code {
	margin-bottom: 4px;
	padding: 14px;
	border-radius: 12px;
	background: var(--sr-primary-050);
}

.sr-modal__code .sr-field { margin-bottom: 8px; }

.sr-modal__code .sr-modal__hint { margin: 0; font-size: .8rem; }

.sr-modal__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.sr-modal__form .sr-field { margin-bottom: 12px; }

.sr-modal .sr-field > span {
	font-size: .84rem;
	font-weight: 500;
	color: var(--sr-text);
}

.sr-modal__note {
	min-height: 20px;
	margin: 0 0 12px;
	font-size: .82rem;
	line-height: 1.7;
	color: var(--sr-red);
}

.sr-modal__note.is-ok { color: #15803d; }

.sr-modal__hint {
	margin: 0 0 14px;
	color: var(--sr-muted);
	font-size: .86rem;
	line-height: 1.9;
}

.sr-modal__link {
	margin-top: 12px;
	border: 0;
	background: none;
	color: var(--sr-primary);
	font-size: .82rem;
	cursor: pointer;
}

.sr-modal__link[disabled] {
	color: var(--sr-muted);
	cursor: default;
}

.sr-modal__done {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin-bottom: 18px;
	padding: 18px;
	border-radius: 14px;
	background: var(--sr-primary-050);
	text-align: center;
}

.sr-modal__done svg { color: var(--sr-primary); }

.sr-modal__done p {
	margin: 0;
	font-size: .92rem;
	line-height: 1.9;
}

.sr-modal__done--ok { background: #e9f9ef; }
.sr-modal__done--ok svg { color: #15803d; }

.sr-modal__tracking {
	font-size: .86rem;
	color: var(--sr-muted);
}

.sr-modal__tracking b {
	color: var(--sr-text);
	letter-spacing: .6px;
}

@keyframes sr-modal-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes sr-modal-rise {
	from { opacity: 0; transform: translateY(14px) scale(.985); }
	to { opacity: 1; transform: none; }
}

body.sr-modal-open { overflow: hidden; }

@media (max-width: 520px) {
	.sr-modal { padding: 12px; align-items: flex-end; }
	.sr-modal__dialog { padding: 22px 18px; border-radius: 16px; }
	.sr-modal__grid { grid-template-columns: 1fr; gap: 0; }
	.sr-modal__actions { grid-template-columns: 1fr; }
	.sr-modal__head h3 { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
	.sr-modal__backdrop,
	.sr-modal__dialog { animation: none; }
}
