/**
 * Berke System 0.6.0 — stabilized front-end contract.
 *
 * Purpose:
 * 1) keep a single typography scale and RTL composition contract;
 * 2) establish shared container/spacing/card/control behavior;
 * 3) normalize historical Berke/Elementor surfaces while they are migrated;
 * 4) avoid changing stored WordPress content.
 */

/* -------------------------------------------------------------------------
 * RTL / bidi contract
 * ---------------------------------------------------------------------- */
body.berke-system-v0600 {
	direction: rtl;
	font-size: var(--berke-type-body);
	line-height: var(--berke-leading-body);
}

body.berke-system-v0600 :where(
	.berke-core-page,
	.berke-p0006,
	.berke-tankseal,
	.berke-site-header,
	.berke-site-footer,
	.berke-mobile-panel,
	.berke-search-dialog,
	.berke-intake-form,
	.berke-service-context-link,
	.elementor
) {
	direction: rtl;
}

body.berke-system-v0600 :where(
	.berke-core-container,
	.berke-core-actions,
	.berke-home-families,
	.berke-service-family-nav,
	.berke-service-family,
	.berke-service-family__items,
	.berke-services-paths,
	.berke-projects-framework,
	.berke-tankseal-hero__grid,
	.berke-tankseal-trust,
	.berke-tankseal-cause-grid,
	.berke-tankseal-choice,
	.berke-tankseal-proof__grid,
	.berke-tankseal-type-grid,
	.berke-tankseal-timeline,
	.berke-tankseal-impact-grid,
	.berke-tankseal-trust-grid,
	.berke-tankseal-info__grid,
	.berke-tankseal-related__layout,
	.berke-tankseal-inquiry__grid,
	.berke-tankseal-related__links,
	.berke-intake-grid,
	.berke-intake-actions,
	.berke-mobile-panel__inner,
	.elementor-container,
	.elementor-row
) {
	direction: rtl;
}

body.berke-system-v0600 :where(input, textarea, select, button) {
	direction: rtl;
	text-align: start;
}

body.berke-system-v0600 :where(
	input[type="tel"],
	input[type="email"],
	input[type="url"],
	[data-berke-ltr],
	.berke-bidi-ltr,
	.berke-tankseal-inquiry__call a
) {
	direction: ltr;
	text-align: right;
	unicode-bidi: plaintext;
}

/* -------------------------------------------------------------------------
 * Typography contract
 * ---------------------------------------------------------------------- */
body.berke-system-v0600 :where(h1, h2, h3, h4, h5, h6) {
	letter-spacing: 0 !important;
	text-wrap: balance;
}

body.berke-system-v0600 :where(h1, .elementor-widget-heading h1.elementor-heading-title) {
	font-size: var(--berke-type-h1) !important;
	font-weight: 800 !important;
	line-height: var(--berke-leading-display) !important;
}

body.berke-system-v0600 :where(h2, .elementor-widget-heading h2.elementor-heading-title) {
	font-size: var(--berke-type-h2) !important;
	font-weight: 700 !important;
	line-height: var(--berke-leading-heading) !important;
}

body.berke-system-v0600 :where(h3, .elementor-widget-heading h3.elementor-heading-title) {
	font-size: var(--berke-type-h3) !important;
	font-weight: 700 !important;
	line-height: var(--berke-leading-heading) !important;
}

body.berke-system-v0600 :where(h4, .elementor-widget-heading h4.elementor-heading-title) {
	font-size: var(--berke-type-h4) !important;
	font-weight: 600 !important;
	line-height: 1.65 !important;
}

body.berke-system-v0600 :where(h5, h6) {
	font-size: 1rem !important;
	font-weight: 600 !important;
	line-height: 1.7 !important;
}

body.berke-system-v0600 :where(p, li, dd, dt, blockquote) {
	line-height: var(--berke-leading-body);
}

body.berke-system-v0600 :where(.elementor-widget-text-editor, .elementor-widget-text-editor p) {
	font-size: var(--berke-type-body);
	line-height: var(--berke-leading-body);
}

body.berke-system-v0600 :where(
	.berke-core-button,
	.berke-ui-button,
	.berke-header-cta,
	.berke-mobile-cta,
	.berke-intake-submit,
	button,
	input[type="submit"]
) {
	font-size: var(--berke-type-control) !important;
	line-height: 1.55 !important;
}

body.berke-system-v0600 :where(label, .berke-field-label, .elementor-field-label) {
	font-size: var(--berke-type-small) !important;
	line-height: 1.75 !important;
}

body.berke-system-v0600 :where(input, textarea, select, .elementor-field) {
	font-size: 1rem !important;
	line-height: 1.75 !important;
}

body.berke-system-v0600 :where(small, figcaption, .berke-text-small) {
	font-size: var(--berke-type-caption) !important;
	line-height: 1.75 !important;
}

/* Metadata/captions may be compact but never become unreadable. */
body.berke-system-v0600 :where(.berke-core-page, .berke-p0006, .berke-tankseal) :where(
	.berke-core-kicker,
	[class*="__eyebrow"],
	[class*="__label"],
	[class*="__meta"],
	[class*="__caption"]
) {
	font-size: var(--berke-type-caption) !important;
	line-height: var(--berke-leading-compact) !important;
}

body.berke-system-v0600 :where(.berke-core-page, .berke-p0006, .berke-tankseal) :where(
	article p,
	article li,
	[class*="card"] p,
	[class*="card"] li,
	[class*="grid"] p,
	[class*="grid"] li
) {
	font-size: var(--berke-type-card) !important;
	line-height: 1.86 !important;
}

/* -------------------------------------------------------------------------
 * Shared layout rhythm
 * ---------------------------------------------------------------------- */
body.berke-system-v0600 :where(.berke-container, .berke-core-container) {
	inline-size: min(calc(100% - (2 * var(--berke-gutter))), var(--berke-container));
	margin-inline: auto;
}

body.berke-system-v0600 :where(.berke-core-page, .berke-p0006, .berke-tankseal) :where(
	.berke-core-lead,
	.berke-home-hero__lead,
	.berke-core-hero__lead,
	.berke-tankseal-lead
) {
	font-size: var(--berke-type-lead) !important;
	line-height: 1.9 !important;
	max-inline-size: var(--berke-content-measure-wide);
}

/* New/shared cards use one family of geometry. Historical components keep
 * their semantics, but excessive decorative radius/shadow is restrained. */
body.berke-system-v0600 :where(
	.berke-ui-card,
	.berke-core-card,
	.berke-service-picker__option,
	.berke-choice-field__option
) {
	border: var(--berke-border-subtle);
	border-radius: var(--berke-radius-md);
	background: var(--berke-color-surface-elevated);
	box-shadow: var(--berke-shadow-xs);
}

body.berke-system-v0600 :where(
	.berke-ui-button,
	.berke-core-button,
	.berke-header-cta,
	.berke-mobile-cta,
	.berke-intake-submit,
	button,
	input[type="submit"]
) {
	min-block-size: var(--berke-control-min-touch);
}

/* Logical alignment is preferred for Persian copy. */
body.berke-system-v0600 :where(
	.berke-core-page,
	.berke-p0006,
	.berke-tankseal,
	.berke-site-footer,
	.berke-intake-form
) :where(h1, h2, h3, h4, p, li, label, summary) {
	text-align: start;
}

/* -------------------------------------------------------------------------
 * Core page calibration
 * ---------------------------------------------------------------------- */
body.berke-system-v0600 .berke-core-page {
	font-size: var(--berke-type-body) !important;
	line-height: var(--berke-leading-body) !important;
}

body.berke-system-v0600 .berke-core-page :where(
	.berke-home-families h3,
	.berke-service-family__items h3,
	.berke-home-projects-preview h3
) {
	font-size: var(--berke-type-h3) !important;
}

/* -------------------------------------------------------------------------
 * P-0007 calibration — latest service reference page
 * ---------------------------------------------------------------------- */
body.berke-system-v0600 .berke-tankseal {
	font-size: var(--berke-type-body) !important;
	line-height: var(--berke-leading-body) !important;
}

body.berke-system-v0600 .berke-tankseal .berke-tankseal-hero__copy h1 {
	max-inline-size: 17ch;
	font-size: var(--berke-type-display) !important;
	font-weight: 800 !important;
	line-height: 1.4 !important;
}

body.berke-system-v0600 .berke-tankseal :where(
	.berke-tankseal-heading h2,
	.berke-tankseal-split h2,
	.berke-tankseal-proof h2,
	.berke-tankseal-cost h2,
	.berke-tankseal-inquiry h2,
	.berke-tankseal-signature__intro h2,
	.berke-tankseal-faq__intro h2,
	.berke-tankseal-related h2
) {
	font-size: var(--berke-type-h2) !important;
	line-height: 1.55 !important;
}

body.berke-system-v0600 .berke-tankseal :where(
	.berke-tankseal-cause-grid h3,
	.berke-tankseal-type h3,
	.berke-tankseal-choice h3,
	.berke-tankseal-impact-grid h3,
	.berke-tankseal-trust-grid h3,
	.berke-tankseal-resource-grid h3
) {
	font-size: var(--berke-type-h3) !important;
	line-height: 1.62 !important;
}

body.berke-system-v0600 .berke-tankseal :where(
	.berke-tankseal-cause-grid p,
	.berke-tankseal-type p,
	.berke-tankseal-choice p,
	.berke-tankseal-impact-grid p,
	.berke-tankseal-trust-grid p,
	.berke-tankseal-resource-grid p,
	.berke-tankseal-faq details p,
	.berke-tankseal-related__links span,
	.berke-tankseal-inquiry__promise span
) {
	font-size: var(--berke-type-card) !important;
	line-height: 1.88 !important;
}

body.berke-system-v0600 .berke-tankseal :where(
	.berke-tankseal-breadcrumb .berke-core-container,
	.berke-tankseal-anchorbar a,
	.berke-tankseal-trust b,
	.berke-tankseal-trust small,
	.berke-tankseal-faq summary,
	.berke-tankseal-related__links b,
	.berke-intake-context-confirmation span,
	.berke-intake-context-confirmation strong,
	.berke-p0007-form-progress,
	.berke-p0007-form-nav button
) {
	font-size: var(--berke-type-small) !important;
}

body.berke-system-v0600 .berke-tankseal .berke-tankseal-anchorbar .berke-core-container {
	justify-content: flex-start;
}

/* Horizontal rails begin at the RTL start edge and preserve breathing room. */
body.berke-system-v0600 :where(
	.berke-tankseal-trust,
	.berke-tankseal-cause-grid,
	.berke-tankseal-type-grid,
	.berke-tankseal-info__grid,
	.berke-services-paths,
	.berke-projects-framework
) {
	direction: rtl;
	scroll-padding-inline-start: var(--berke-gutter);
}

/* -------------------------------------------------------------------------
 * Header / footer / historical readability floor
 * ---------------------------------------------------------------------- */
body.berke-system-v0600 :where(
	.berke-site-branding__tagline,
	.berke-mobile-drawer__heading span,
	.berke-core-label,
	.berke-core-media__caption span,
	.berke-home-service-row__num,
	.berke-core-process li > span,
	.berke-service-family-nav a > span,
	.berke-about-principles li > span,
	.berke-project-card dt,
	.berke-request-mini-process span,
	.berke-service-picker__hint,
	.berke-choice-field__hint,
	.berke-intake-wizard__progress span,
	.berke-intake-wizard__progress b,
	.berke-footer-bottom__inner,
	.berke-mobile-actionbar a
) {
	font-size: var(--berke-type-caption) !important;
	line-height: var(--berke-leading-compact) !important;
}

body.berke-system-v0600 .berke-tankseal :where(
	.berke-tankseal-hero__caption span,
	.berke-tankseal-hero__caption strong,
	.berke-tankseal-choice__label,
	.berke-tankseal-choice ul,
	.berke-tankseal-choice__statement span,
	.berke-tankseal-type strong,
	.berke-tankseal-type a,
	.berke-tankseal-potable__facts b,
	.berke-tankseal-potable__facts span,
	.berke-tankseal-timeline li > span,
	.berke-tankseal-timeline p,
	.berke-tankseal-impact-grid article > span,
	.berke-tankseal-trust-grid span,
	.berke-tankseal-info__grid span,
	.berke-tankseal-resource-grid > a > span,
	.berke-tankseal-inquiry__call span
) {
	font-size: var(--berke-type-caption) !important;
	line-height: 1.75 !important;
}

body.berke-system-v0600 :where(
	.berke-site-header a,
	.berke-site-header button,
	.berke-site-footer a,
	.berke-mobile-panel a,
	.berke-mobile-panel button
) {
	font-size: var(--berke-type-small);
	line-height: 1.65;
}

/* -------------------------------------------------------------------------
 * Responsive contract
 * ---------------------------------------------------------------------- */
@media (max-width: 47.999rem) {
	body.berke-system-v0600 .berke-tankseal .berke-tankseal-hero__copy h1 {
		font-size: var(--berke-type-display) !important;
		line-height: 1.47 !important;
	}

	body.berke-system-v0600 :where(
		.berke-tankseal-anchorbar .berke-core-container,
		.berke-tankseal-trust,
		.berke-tankseal-cause-grid,
		.berke-tankseal-type-grid,
		.berke-tankseal-info__grid
	) {
		direction: rtl;
	}

	body.berke-system-v0600 :where(input, textarea, select, .elementor-field) {
		font-size: 1rem !important; /* iOS zoom guard */
	}
}

@media (prefers-reduced-motion: reduce) {
	body.berke-system-v0600 *,
	body.berke-system-v0600 *::before,
	body.berke-system-v0600 *::after {
		scroll-behavior: auto !important;
	}
}
