/**
 * Websly Parent — base stylesheet.
 *
 * :root below defines EVERY token in the design-token registry (decisions
 * doc D2 / Design Kit S3) at a neutral default. A child theme overrides the
 * same custom properties in its own :root — see decisions doc A4. Never add
 * a brand colour/font value here; neutral/system defaults only (A6).
 */

:root {
	/* Colour */
	--websly-color-primary: #1a1a1a;
	--websly-color-primary-contrast: #ffffff;
	--websly-color-secondary: #4a4a4a;
	--websly-color-accent: #6b6b6b;
	--websly-color-surface: #ffffff;
	--websly-color-surface-alt: #f4f4f4;
	--websly-color-surface-inverse: #1a1a1a;
	--websly-color-text: #1a1a1a;
	--websly-color-text-muted: #6b6b6b;
	--websly-color-text-inverse: #ffffff;
	--websly-color-border: #e0e0e0;
	--websly-color-link: var(--websly-color-primary);
	--websly-color-error: #b3261e;
	--websly-color-success: #2e7d32;

	/* Typography */
	--websly-font-heading: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--websly-font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--websly-font-weight-heading: 700;
	--websly-text-xs: 0.75rem;
	--websly-text-sm: 0.875rem;
	--websly-text-base: 1rem;
	--websly-text-lg: 1.125rem;
	--websly-text-xl: 1.375rem;
	--websly-text-2xl: 1.75rem;
	--websly-text-3xl: 2.25rem;
	--websly-text-4xl: 3rem;
	--websly-leading-tight: 1.15;
	--websly-leading-normal: 1.6;

	/* Spacing & layout */
	--websly-space-2xs: 0.25rem;
	--websly-space-xs: 0.5rem;
	--websly-space-sm: 0.75rem;
	--websly-space-md: 1.25rem;
	--websly-space-lg: 2rem;
	--websly-space-xl: 3rem;
	--websly-space-2xl: 4.5rem;
	--websly-space-3xl: 6rem;
	--websly-section-pad-y: var(--websly-space-2xl);
	--websly-container-max: 72rem;
	--websly-container-wide: 90rem;
	--websly-container-narrow: 45rem;

	/* Shape */
	--websly-radius-sm: 0.25rem;
	--websly-radius-md: 0.5rem;
	--websly-radius-lg: 1rem;
	--websly-radius-pill: 999px;
	--websly-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
	--websly-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
	--websly-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
	--websly-button-radius: var(--websly-radius-md);
}

/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
p, h1, h2, h3, h4, ul, ol { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
	.js [data-websly-nav="drawer"] .websly-nav-panel,
	.js [data-websly-nav="dropdown"] .websly-nav-panel {
		transition: none;
	}
}

/* ---------- Base typography ---------- */

body {
	font-family: var(--websly-font-body);
	font-size: var(--websly-text-base);
	line-height: var(--websly-leading-normal);
	color: var(--websly-color-text);
	background-color: var(--websly-color-surface);
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--websly-font-heading);
	font-weight: var(--websly-font-weight-heading);
	line-height: var(--websly-leading-tight);
}

h1 { font-size: var(--websly-text-4xl); }
h2 { font-size: var(--websly-text-3xl); }
h3 { font-size: var(--websly-text-xl); }

a {
	text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
	outline: 2px solid var(--websly-color-primary);
	outline-offset: 2px;
}

/* ---------- Visually hidden (D14-R1: hidden post-title h1 fallback) ---------- */

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

/* ---------- Skip link ---------- */

.websly-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 999;
	padding: var(--websly-space-xs) var(--websly-space-sm);
	background: var(--websly-color-surface);
	color: var(--websly-color-text);
	border-radius: var(--websly-radius-sm);
}
.websly-skip-link:focus {
	left: var(--websly-space-sm);
	top: var(--websly-space-sm);
}

/* ---------- Layout containers (D4) ---------- */

.websly-container {
	width: 100%;
	max-width: var(--websly-container-max);
	margin-inline: auto;
	padding-inline: var(--websly-space-md);
}
.websly-container--wide { max-width: var(--websly-container-wide); }
.websly-container--narrow { max-width: var(--websly-container-narrow); }

/* ---------- Section wrapper (A2) ---------- */

.websly-section {
	padding-block: var(--websly-section-pad-y);
	/* Positioning context for D14-R3.2's front-end "Edit this section" link
	   (content-types' section-edit-link.php) — pinning it here, not to
	   in-flow placement after the render_start hook, is what keeps its size
	   and corner identical across every section template regardless of that
	   template's own internal layout (flex/grid centering, hero overlays). */
	position: relative;
}
.websly-section--pad-compact { padding-block: var(--websly-space-lg); }
.websly-section--pad-spacious { padding-block: var(--websly-space-3xl); }

.websly-section--bg-default { background-color: var(--websly-color-surface); color: var(--websly-color-text); }
.websly-section--bg-tint { background-color: var(--websly-color-surface-alt); color: var(--websly-color-text); }
.websly-section--bg-inverse { background-color: var(--websly-color-surface-inverse); color: var(--websly-color-text-inverse); }

/*
 * width/align (D45-CATALOG/T17, shared section_options). The two-class
 * descendant selectors below out-specificity any single hardcoded modifier
 * a template's own `.websly-container` carries (e.g. contact.php's
 * `--narrow`), so an explicit width/align always wins regardless of source
 * order; no wrapper class (the 'default'/'left' case) leaves every
 * template's own container class as the sole authority, unchanged from
 * before this shipped.
 */
.websly-section--width-wide .websly-container,
.websly-section--width-wide .websly-section__intro { max-width: var(--websly-container-wide); }
.websly-section--width-narrow .websly-container,
.websly-section--width-narrow .websly-section__intro { max-width: var(--websly-container-narrow); }
.websly-section--align-center .websly-section__intro { margin-inline: auto; text-align: center; }

/* ---------- Buttons (shared by CTA fields across sections) ---------- */

.websly-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--websly-space-2xs);
	padding: var(--websly-space-xs) var(--websly-space-md);
	border-radius: var(--websly-button-radius);
	font-weight: 600;
	text-decoration: none;
	border: 1px solid transparent;
	cursor: pointer;
}
.websly-btn--primary {
	background-color: var(--websly-color-primary);
	color: var(--websly-color-primary-contrast);
}
.websly-btn--secondary {
	background-color: transparent;
	color: currentColor;
	border-color: currentColor;
}

/* ---------- Grid utility (shared by every card-based section + archives) ---------- */

.websly-grid {
	display: grid;
	gap: var(--websly-space-lg);
}
.websly-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.websly-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.websly-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 48rem) {
	.websly-grid--cols-2,
	.websly-grid--cols-3,
	.websly-grid--cols-4 {
		grid-template-columns: 1fr;
	}
}
@media (min-width: 48.0625rem) and (max-width: 64rem) {
	.websly-grid--cols-3,
	.websly-grid--cols-4 {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ---------- Cards (loop partials: project / service / testimonial) ---------- */

.websly-card {
	background-color: var(--websly-color-surface);
	border: 1px solid var(--websly-color-border);
	border-radius: var(--websly-radius-lg);
	box-shadow: var(--websly-shadow-sm);
	overflow: hidden;
}

/* ---------- Site chrome: header (H1 variants + D45-K mobile nav) ---------- */

.websly-utility-bar {
	background-color: var(--websly-color-surface-inverse);
	color: var(--websly-color-text-inverse);
}
.websly-utility-bar__inner {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--websly-space-md);
	flex-wrap: wrap;
	padding-block: var(--websly-space-2xs);
	font-size: var(--websly-text-xs);
}
.websly-utility-bar__link {
	text-decoration: none;
}
.websly-utility-bar__link:hover {
	text-decoration: underline;
}
.websly-utility-bar__address {
	opacity: 0.85;
}
.websly-header {
	position: relative;
	background-color: var(--websly-color-surface);
	border-bottom: 1px solid var(--websly-color-border);
}
.websly-header--sticky {
	position: sticky;
	top: 0;
	z-index: 100;
}
.websly-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--websly-space-md);
	padding-block: var(--websly-space-sm);
}
.websly-header--centered .websly-header__inner {
	flex-direction: column;
	text-align: center;
}
.websly-logo__image {
	max-height: 2.5rem;
	width: auto;
}
.websly-logo--text {
	font-family: var(--websly-font-heading);
	font-weight: var(--websly-font-weight-heading);
	font-size: var(--websly-text-lg);
	text-decoration: none;
}
.websly-nav-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid var(--websly-color-border);
	border-radius: var(--websly-radius-sm);
	cursor: pointer;
	padding: var(--websly-space-xs);
	color: var(--websly-color-text);
}
.websly-nav-toggle__bars {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--websly-space-2xs);
	width: 1.5rem;
	height: 1.25rem;
}
.websly-nav-toggle__bars span {
	display: block;
	width: 100%;
	height: 0.125rem;
	border-radius: var(--websly-radius-pill);
	background-color: currentColor;
	transition: transform 180ms ease, opacity 180ms ease;
	transform-origin: center;
}
[data-websly-nav-state="open"] .websly-nav-toggle__bars span:nth-child(1) {
	transform: translateY(calc(var(--websly-space-2xs) + 0.125rem)) rotate(45deg);
}
[data-websly-nav-state="open"] .websly-nav-toggle__bars span:nth-child(2) {
	opacity: 0;
}
[data-websly-nav-state="open"] .websly-nav-toggle__bars span:nth-child(3) {
	transform: translateY(calc((var(--websly-space-2xs) + 0.125rem) * -1)) rotate(-45deg);
}
.websly-nav-panel {
	display: block;
}
.websly-nav-close,
.websly-nav-scrim {
	display: none;
}
.websly-nav__list,
.websly-footer__nav-list {
	display: flex;
	gap: var(--websly-space-md);
	flex-wrap: wrap;
}
.websly-nav__list a,
.websly-footer__nav-list a {
	text-decoration: none;
}
body.websly-nav-scroll-lock {
	overflow: hidden;
}

@media (max-width: 48rem) {
	.websly-utility-bar {
		display: none;
	}
	.websly-header__inner {
		flex-wrap: wrap;
	}
	.js .websly-nav-toggle {
		display: inline-flex;
	}
	.no-js .websly-nav-toggle {
		display: none;
	}
	.websly-nav-panel {
		width: 100%;
		order: 3;
		background-color: var(--websly-color-surface);
		color: var(--websly-color-text);
	}
	.no-js .websly-nav-panel {
		display: block;
		position: static;
		padding-block: var(--websly-space-md);
	}
	.no-js .websly-nav__list {
		flex-direction: column;
		gap: var(--websly-space-sm);
	}
	.js .websly-nav-panel {
		visibility: hidden;
		opacity: 0;
		pointer-events: none;
		transition: transform 220ms ease, opacity 220ms ease;
		z-index: 130;
	}
	.js [data-websly-nav-state="open"] .websly-nav-panel {
		visibility: visible;
		opacity: 1;
		pointer-events: auto;
	}
	.js .websly-nav-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		align-self: flex-end;
		background: transparent;
		border: 1px solid var(--websly-color-border);
		border-radius: var(--websly-radius-sm);
		cursor: pointer;
		padding: var(--websly-space-xs);
		line-height: 1;
	}
	.js .websly-nav__list {
		flex-direction: column;
		gap: var(--websly-space-sm);
	}
	.js [data-websly-nav="drawer"] .websly-nav-panel {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		display: flex;
		flex-direction: column;
		gap: var(--websly-space-lg);
		width: min(22rem, calc(100vw - var(--websly-space-lg)));
		max-width: 100%;
		padding: var(--websly-space-lg);
		box-shadow: var(--websly-shadow-lg);
		transform: translateX(100%);
		overflow-y: auto;
	}
	.js [data-websly-nav="drawer"][data-websly-nav-state="open"] .websly-nav-panel {
		transform: translateX(0);
	}
	.js [data-websly-nav="drawer"] .websly-nav-scrim {
		position: fixed;
		inset: 0;
		display: block;
		background-color: var(--websly-color-text);
		opacity: 0;
		pointer-events: none;
		transition: opacity 220ms ease;
		z-index: 120;
	}
	.js [data-websly-nav="drawer"][data-websly-nav-state="open"] .websly-nav-scrim {
		opacity: 0.48;
		pointer-events: auto;
	}
	.js [data-websly-nav="dropdown"] .websly-nav-panel {
		position: absolute;
		left: 0;
		right: 0;
		top: calc(100% + 0.0625rem);
		padding: var(--websly-space-md);
		border-bottom: 1px solid var(--websly-color-border);
		box-shadow: var(--websly-shadow-md);
	}

	.js [data-websly-nav="dropdown"] .websly-nav-scrim {
		display: none;
	}
}
/* ---------- Site chrome: footer (auto-composed, H1) ---------- */

.websly-footer__grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--websly-space-lg);
	padding-block: var(--websly-space-xl);
}
.websly-footer__tagline {
	margin-block-start: var(--websly-space-xs);
	opacity: 0.8;
}
.websly-footer__socials {
	display: flex;
	gap: var(--websly-space-sm);
	flex-wrap: wrap;
}
.websly-footer__legal {
	display: flex;
	justify-content: space-between;
	gap: var(--websly-space-sm);
	flex-wrap: wrap;
	padding-block: var(--websly-space-md);
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	font-size: var(--websly-text-sm);
	opacity: 0.8;
}

@media (max-width: 48rem) {
	.websly-footer__grid {
		grid-template-columns: 1fr;
	}
	.websly-footer__legal {
		flex-direction: column;
	}
}

/* ---------- Upsell placeholder (D4 — shared across any gated widget) ---------- */

.websly-upsell {
	padding: var(--websly-space-md);
	border: 1px dashed var(--websly-color-border);
	border-radius: var(--websly-radius-md);
	color: var(--websly-color-text-muted);
	text-align: center;
}

/* ---------- Single-project gallery lightbox (D21-C.2 — native <dialog>; main.js drives it) ---------- */

.websly-lightbox {
	max-width: min(90vw, 60rem);
	max-height: 90vh;
	padding: var(--websly-space-lg);
	border: none;
	border-radius: var(--websly-radius-md);
	background-color: var(--websly-color-surface-inverse);
	color: var(--websly-color-text-inverse);
}
.websly-lightbox::backdrop {
	background-color: rgba(0, 0, 0, 0.85);
}
.websly-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: 70vh;
	margin-inline: auto;
	border-radius: var(--websly-radius-sm);
}
.websly-lightbox__close,
.websly-lightbox__prev,
.websly-lightbox__next {
	position: absolute;
	background: none;
	border: none;
	color: var(--websly-color-text-inverse);
	font-size: var(--websly-text-2xl);
	cursor: pointer;
	line-height: 1;
}
.websly-lightbox__close {
	top: var(--websly-space-md);
	right: var(--websly-space-md);
}
.websly-lightbox__prev {
	top: 50%;
	left: var(--websly-space-sm);
	transform: translateY(-50%);
}
.websly-lightbox__next {
	top: 50%;
	right: var(--websly-space-sm);
	transform: translateY(-50%);
}
.websly-lightbox__counter {
	margin-block-start: var(--websly-space-sm);
	text-align: center;
	font-size: var(--websly-text-sm);
}

/* ---------- Single-project gallery grid (D21-C.1) ---------- */

.websly-project-gallery {
	margin-block-start: var(--websly-space-lg);
}
.websly-project-gallery__item img {
	width: 100%;
	border-radius: var(--websly-radius-sm);
}

.websly-card__link {
	display: block;
	text-decoration: none;
	color: inherit;
}
.websly-card__media img,
.websly-card__icon img {
	width: 100%;
}
.websly-card__body {
	padding: var(--websly-space-md);
}
.websly-card__title {
	margin-block-end: var(--websly-space-2xs);
}
.websly-card__meta,
.websly-card__excerpt,
.websly-card__author-meta {
	color: var(--websly-color-text-muted);
	font-size: var(--websly-text-sm);
}
.websly-card__features {
	list-style: disc;
	padding-inline-start: var(--websly-space-md);
	margin-block-start: var(--websly-space-xs);
	display: flex;
	flex-direction: column;
	gap: var(--websly-space-2xs);
}
.websly-card__features li {
	color: var(--websly-color-text-muted);
	font-size: var(--websly-text-sm);
}
.websly-card__features li::marker {
	color: var(--websly-color-accent);
}
.websly-card--testimonial .websly-card__quote {
	margin-block: var(--websly-space-sm);
	font-style: italic;
}
.websly-card--testimonial .websly-card__rating {
	color: var(--websly-color-accent);
	letter-spacing: 0.1em;
}

/* ---------- Section intro (shared heading+intro pattern) ---------- */

.websly-section__intro {
	margin-block-end: var(--websly-space-lg);
	max-width: var(--websly-container-narrow);
}
.websly-section__intro h2 {
	margin-block-end: var(--websly-space-xs);
}
