/*
Theme Name: Bavis
Theme URI: https://bavis.co.uk
Author: Bavis
Description: Bespoke block theme for Bavis — Fractional CMO & Strategic Marketing Consultancy. Charcoal, off-white and cobalt, with editable page patterns for every core page.
Version: 1.2.1
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bavis
*/

/* ---------- Page rhythm ---------- */
.wp-site-blocks > * { margin-block-start: 0; }
.wp-block-post-content > .bv-section,
.wp-block-post-content > .alignfull,
.editor-styles-wrapper .bv-section.alignfull { margin-block: 0; }
.bv-main { margin: 0; }

/* ---------- Sections ---------- */
.bv-section { padding-block: clamp(80px, 9vw, 128px); }
.bv-section--hero { padding-block: clamp(64px, 8vw, 112px) clamp(72px, 8vw, 112px); }
.bv-section--compact { padding-block: clamp(56px, 7vw, 96px); }
.bv-dark { background: var(--wp--preset--color--charcoal); color: var(--wp--preset--color--off-white); }
.bv-stone { background: var(--wp--preset--color--stone); }
.bv-cobalt { background: var(--wp--preset--color--cobalt); color: var(--wp--preset--color--white); }
.bv-rule-top { border-top: 1px solid #DDDAD3; }

.bv-dark a:not(.wp-element-button),
.bv-cobalt a:not(.wp-element-button),
.bv-card--dark a:not(.wp-element-button) { color: inherit; }
.bv-dark a:not(.wp-element-button):hover,
.bv-card--dark a:not(.wp-element-button):hover { color: var(--wp--preset--color--cobalt-light); }
.bv-cobalt a:not(.wp-element-button):hover { color: var(--wp--preset--color--cobalt-pale); }

/* ---------- Type ---------- */
.bv-eyebrow {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 14px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--cobalt);
	line-height: 1.4;
}
.bv-dark .bv-eyebrow,
.bv-card--dark .bv-eyebrow { color: var(--wp--preset--color--cobalt-light); }
.bv-hero .bv-eyebrow { color: var(--wp--preset--color--mist); }
.bv-cobalt .bv-eyebrow { color: var(--wp--preset--color--cobalt-pale); }
.bv-section .bv-eyebrow + * { margin-block-start: 14px; }

/* Narrow text blocks line up with the left edge of the 1320px column instead of centring. */
.is-layout-constrained > :is(.bv-hero-title, .bv-hero-title--wide, .bv-narrow, .bv-measure, .bv-statement, .bv-display-cta, .bv-quote) {
	margin-left: max(0px, calc((100% - 1320px) / 2)) !important;
	margin-right: auto !important;
}
.bv-hero-title { max-width: 15ch; }
.bv-hero-title--wide { max-width: 18ch; }
.bv-narrow { max-width: 20ch; }
.bv-measure { max-width: 48ch; }
.bv-lead { font-size: var(--wp--preset--font-size--large); line-height: 1.5; }
.bv-dark .bv-lead, .bv-dark .bv-soft, .bv-card--dark .bv-soft { color: var(--wp--preset--color--mist); }
.bv-soft { color: var(--wp--preset--color--slate); }
.bv-muted { color: var(--wp--preset--color--muted); font-size: 15px; }
.bv-statement {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1.22;
	letter-spacing: -0.02em;
	max-width: 34ch;
}
.bv-display-cta { font-size: clamp(48px, 7vw, 112px); line-height: 0.92; letter-spacing: -0.045em; max-width: 12ch; }
.bv-big-word {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: clamp(40px, 4.4vw, 60px);
	line-height: 1;
	letter-spacing: -0.04em;
}
.bv-glyph {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: 64px;
	line-height: 1;
	color: var(--wp--preset--color--cobalt);
}
.bv-num {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 14px;
	color: var(--wp--preset--color--cobalt);
}
.bv-dark .bv-num, .bv-card--dark .bv-num { color: var(--wp--preset--color--cobalt-light); }

/* ---------- Spacing helpers ---------- */
.bv-section .bv-mt-lg { margin-block-start: clamp(40px, 4vw, 56px); }
.bv-section .bv-mt-xl { margin-block-start: clamp(48px, 5vw, 72px); }
.bv-hero-foot {
	margin-block-start: clamp(40px, 5vw, 64px) !important;
	padding-top: 32px;
	border-top: 1px solid rgba(250, 249, 246, 0.18);
}
.bv-hero-foot.wp-block-columns { gap: 40px; }

/* ---------- Cards & grids ---------- */
.bv-cards.is-layout-grid { gap: 16px; }
.bv-card {
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--charcoal);
	border-radius: 16px;
	padding: 32px;
}
.bv-card--soft { background: var(--wp--preset--color--stone); }
.bv-card--dark { background: var(--wp--preset--color--charcoal); color: var(--wp--preset--color--off-white); }
.bv-card--outline { background: transparent; border: 1px solid #C9C6BE; }
.bv-card--accent { border: 2px solid var(--wp--preset--color--cobalt); }
.bv-card--lg { padding: clamp(32px, 4vw, 56px); border-radius: 20px; }
.bv-card > :first-child { margin-block-start: 0; }
.bv-card h3 { margin-block-start: 12px; }
.bv-card .bv-soft { font-size: 16px; }
.bv-card--link { transition: transform .2s ease, box-shadow .2s ease; }
.bv-card--link:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(32, 37, 43, .08); }

.bv-features.is-layout-grid { gap: 0 24px; border-top: 1px solid var(--wp--preset--color--charcoal); }
.bv-features > * { padding: 28px 0; border-bottom: 1px solid #D9D6CF; margin: 0 !important; }
.bv-features h3 { margin-block-start: 10px; font-size: 23px; }
.bv-features p:last-child { margin-block-start: 6px; font-size: 16px; }

.bv-steps.is-layout-grid { gap: 32px; }
.bv-step { border-top: 2px solid #C9C6BE; padding-top: 24px; }
.bv-step:first-child { border-top-color: var(--wp--preset--color--cobalt); }
.bv-dark .bv-step { border-top-color: #3A4048; }
.bv-dark .bv-step:first-child { border-top-color: var(--wp--preset--color--cobalt-light); }
.bv-step > * { margin-block-start: 0; }
.bv-step h3 { margin-block: 12px 8px; }
.bv-step p:last-child { font-size: 16px; }

/* ---------- Lists ---------- */
.bv-list { list-style: none; padding-left: 0; margin-block: 0; }
.bv-list li { position: relative; padding-left: 30px; }
.bv-list li + li { margin-top: 14px; }
.bv-list li::before { position: absolute; left: 0; top: 0; font-weight: 600; color: var(--wp--preset--color--cobalt); }
.bv-dark .bv-list li::before, .bv-card--dark .bv-list li::before { color: var(--wp--preset--color--cobalt-light); }
.bv-list--ticks li::before { content: "✓"; }
.bv-list--arrows li::before { content: "→"; }
.bv-list--cross li::before { content: "×"; color: var(--wp--preset--color--muted); }
.bv-list--rows li { padding-block: 18px; border-bottom: 1px solid #ECEAE4; }
.bv-list--rows li + li { margin-top: 0; }
.bv-list--rows li::before { top: 18px; }
.bv-list--rows li:last-child { border-bottom: 0; }
.bv-dark .bv-list--rows li, .bv-card--dark .bv-list--rows li { border-bottom-color: #3A4048; }
.bv-list--numbered { counter-reset: bv; }
.bv-list--numbered li { counter-increment: bv; padding: 20px 0 20px 44px; border-top: 1px solid #3A4048; margin: 0; }
.bv-list--numbered li:last-child { border-bottom: 1px solid #3A4048; }
.bv-list--numbered li::before {
	content: counter(bv, decimal-leading-zero);
	top: 22px;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 14px;
	font-weight: 400;
}
.bv-section:not(.bv-dark) .bv-list--numbered li { border-color: #DDDAD3; }

/* ---------- Pills, quotes, FAQ ---------- */
.bv-pills.is-layout-flex { gap: 10px; }
.bv-pill { border: 1px solid #C9C6BE; border-radius: 999px; padding: 8px 16px; font-size: 15px; margin: 0 !important; }
.bv-quote {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	font-size: clamp(28px, 3.4vw, 48px);
	line-height: 1.18;
	letter-spacing: -0.025em;
	max-width: 28ch;
}
.bv-faq { border-top: 1px solid var(--wp--preset--color--charcoal); }
.bv-faq > * { margin: 0 !important; }
.bv-faq .wp-block-details { padding: 22px 0; border-bottom: 1px solid #D9D6CF; }
.bv-faq summary {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	font-size: 21px;
	line-height: 1.3;
	cursor: pointer;
}
.bv-faq .wp-block-details p { color: var(--wp--preset--color--slate); margin-top: 12px; }

/* ---------- Media & placeholders ---------- */
.bv-media img { border-radius: 16px; width: 100%; height: auto; display: block; }
.bv-placeholder {
	border: 1px dashed #B9B5AB;
	border-radius: 16px;
	padding: 32px;
	color: var(--wp--preset--color--muted);
	background: rgba(255, 255, 255, .5);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: .04em;
}

/* ---------- Buttons ---------- */
.wp-block-button__link { transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--charcoal);
	border: 1px solid currentColor;
	padding: 15px 23px;
}
.bv-dark .wp-block-button.is-style-outline > .wp-block-button__link,
.bv-card--dark .wp-block-button.is-style-outline > .wp-block-button__link { color: var(--wp--preset--color--off-white); border-color: rgba(250, 249, 246, .45); }
.bv-cobalt .wp-block-button:not(.is-style-outline) > .wp-block-button__link { background: var(--wp--preset--color--charcoal); color: var(--wp--preset--color--off-white); }
.bv-cobalt .wp-block-button:not(.is-style-outline) > .wp-block-button__link:hover { background: #000; }
.bv-buttons-lg .wp-block-button__link { font-size: 18px; padding: 18px 28px; }

/* ---------- Header & logo ---------- */
.bv-header {
	background: var(--wp--preset--color--charcoal);
	color: var(--wp--preset--color--off-white);
	border-bottom: 1px solid #3A4048;
	padding-block: 20px;
}
.bv-logo a { text-decoration: none; color: inherit !important; }
.bv-logo a::after { content: "↗"; color: var(--wp--preset--color--cobalt-tint); }
.bv-cobalt .bv-logo a::after { color: var(--wp--preset--color--white); }
.bv-nav a { color: #D7D9DD; text-decoration: none; }
.bv-nav a:hover, .bv-nav .current-menu-item > a { color: var(--wp--preset--color--off-white); }
.bv-nav .wp-block-navigation__responsive-container.is-menu-open { padding: 32px clamp(20px, 4vw, 56px); }
.bv-nav .wp-block-navigation__responsive-container.is-menu-open a { font-size: 22px; color: var(--wp--preset--color--off-white); }
.bv-header .wp-block-button__link { padding: 12px 22px; font-size: 15px; }
.bv-header__actions.is-layout-flex { gap: 28px; }

/* ---------- Footer ---------- */
.bv-footer { padding-block: 48px 32px; }
.bv-footer p { margin: 0; }
.bv-footer .bv-footer__label {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 13px;
	text-transform: uppercase;
	color: var(--wp--preset--color--cobalt-pale);
	margin-bottom: 8px;
}
.bv-footer a { text-decoration: none; }
.bv-footer__cols.is-layout-grid { gap: 32px; }
.bv-footer__cols > * > * + * { margin-top: 8px !important; }
.bv-footer__base {
	margin-top: 40px !important;
	padding-top: 20px;
	border-top: 1px solid rgba(255, 255, 255, .25);
	font-size: 14px;
	color: var(--wp--preset--color--cobalt-pale);
}

/* ---------- Posts ---------- */
.bv-posts .wp-block-post-template.is-layout-grid { gap: 16px; }
.bv-post-card { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; }
.bv-post-card .wp-block-post-title { font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; margin-top: 12px; }
.bv-post-card .wp-block-post-title a { text-decoration: none; }
.bv-post-card .wp-block-post-terms a { text-decoration: none; color: inherit; }
.bv-post-card .wp-block-post-date { margin-top: auto; padding-top: 16px; font-size: 14px; color: var(--wp--preset--color--muted); }
.bv-article .wp-block-post-content > * { max-width: 760px; }

/* ---------- Small screens ---------- */
@media (max-width: 781px) {
	.bv-card { padding: 26px; }
	/* Keep a compact "Let's talk" button beside the menu on phones. */
	.bv-header__actions.is-layout-flex { gap: 14px; flex-wrap: nowrap; }
	.bv-header .wp-block-button__link { padding: 10px 16px; font-size: 14px; white-space: nowrap; }
}

/* ---------- v1.1: sticky call to action on the landing page (phones only) ---------- */
.bv-sticky-cta { display: none; }
@media (max-width: 781px) {
	.bv-sticky-cta {
		display: block;
		position: fixed;
		left: 12px;
		right: 12px;
		bottom: 12px;
		z-index: 50;
		margin: 0 !important;
	}
	.bv-sticky-cta .wp-block-buttons, .bv-sticky-cta .wp-block-button { width: 100%; }
	.bv-sticky-cta .wp-block-button__link { width: 100%; box-sizing: border-box; text-align: center; box-shadow: 0 10px 30px rgba(32, 37, 43, .35); }
	.wp-site-blocks:has(.bv-sticky-cta) { padding-bottom: 84px; }
}

/* ---------- v1.1: author box and photos ---------- */
.bv-author .bv-media img { border-radius: 50%; max-width: 160px; aspect-ratio: 1; object-fit: cover; }
.bv-author.wp-block-columns { gap: 32px; }
.bv-author > .wp-block-column:first-child { flex: 0 0 160px !important; }
.bv-media img { aspect-ratio: 4 / 5; object-fit: cover; }
.bv-post-card .wp-block-post-excerpt__more-link { font-weight: 500; }
.bv-post-card .wp-block-post-excerpt__more-text { margin-top: 16px; }

/* ---------- Responsive column counts ----------
   Each grid shows up to N columns on wide screens and stacks naturally on smaller ones. */
.is-layout-grid[class*="bv-cols-"],
.bv-posts .wp-block-post-template.is-layout-grid {
	grid-template-columns: repeat(auto-fit, minmax(max(min(var(--bv-min, 280px), 100%), calc((100% - (var(--bv-n, 3) - 1) * var(--bv-gap, 16px)) / var(--bv-n, 3))), 1fr)) !important;
}
.bv-cols-1 { --bv-n: 1; } .bv-cols-2 { --bv-n: 2; } .bv-cols-3 { --bv-n: 3; } .bv-cols-4 { --bv-n: 4; } .bv-cols-5 { --bv-n: 5; }
.bv-min-200 { --bv-min: 200px; } .bv-min-220 { --bv-min: 220px; } .bv-min-240 { --bv-min: 240px; }
.bv-min-260 { --bv-min: 260px; } .bv-min-280 { --bv-min: 280px; } .bv-min-300 { --bv-min: 300px; } .bv-min-320 { --bv-min: 320px; }
.bv-steps { --bv-gap: 32px; }
.bv-features { --bv-gap: 24px; }
.bv-footer__cols { --bv-gap: 32px; }

/* ---------- Light cards placed inside charcoal sections ---------- */
.bv-card:not(.bv-card--dark) .bv-eyebrow { color: var(--wp--preset--color--cobalt); }
.bv-card:not(.bv-card--dark) .bv-list li::before { color: var(--wp--preset--color--cobalt); }
.bv-card:not(.bv-card--dark) .bv-list--rows li { border-bottom-color: #ECEAE4; }
.bv-card:not(.bv-card--dark) .bv-soft { color: var(--wp--preset--color--slate); }
.bv-card .bv-big-word + .bv-list { margin-top: 20px; }

/* Split heroes (headline beside a card or photo) use a slightly smaller headline. */
.bv-hero-title--split { font-size: clamp(44px, 5.6vw, 88px) !important; max-width: 13ch; }
/* Tablet and small laptop: fold the menu into the menu button instead of wrapping onto two lines. */
@media (min-width: 600px) and (max-width: 1100px) {
	.bv-nav .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex !important; }
	.bv-nav .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none !important; }
	.bv-nav .wp-block-navigation__responsive-container.is-menu-open { display: flex !important; }
	.bv-header__actions.is-layout-flex { flex-wrap: nowrap; }
	.bv-nav .is-menu-open .wp-block-navigation__container { align-items: flex-start !important; gap: 20px; }
	.bv-nav .is-menu-open a { font-size: 22px !important; }
}

/* Opened menu (phones and tablets): left-aligned, larger links in the display font. */
.bv-nav .is-menu-open .wp-block-navigation__responsive-container-content { align-items: flex-start !important; padding-top: 32px; }
.bv-nav .is-menu-open .wp-block-navigation-item__content { font-family: var(--wp--preset--font-family--display, inherit); font-weight: 600; }

/* Carl's photo: smaller and less dominant beside the text. */
.bv-media:not(.bv-author .bv-media) { max-width: 360px; }
@media (min-width: 782px) {
	.wp-block-columns:not(.bv-author) > .wp-block-column:has(> .bv-media) { flex: 0 0 360px !important; }
	.wp-block-columns:not(.bv-author):has(> .wp-block-column > .bv-media) { gap: clamp(48px, 6vw, 96px); }
}
@media (max-width: 781px) { .bv-media:not(.bv-author .bv-media) { max-width: 260px; } }

/* Hidden sections (add the class bv-hidden to a section to hide it on the live site; it stays visible in the editor). */
body:not(.editor-styles-wrapper) .bv-hidden { display: none !important; }
/* A single card on its own, kept to a readable width. */
.wp-block-columns.bv-single { max-width: 760px !important; margin-left: max(0px, calc((100% - 1320px) / 2)) !important; margin-right: auto !important; }

/* Card titles that need to stand out (for example the Strategic Marketing Review panel). */
.bv-card-title { font-size: clamp(26px, 2.6vw, 34px) !important; line-height: 1.1; margin: 10px 0 12px !important; }

/* Enquiry form (built into the site, sends to HubSpot). */
.bv-form { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.bv-form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 18px; }
.bv-field { display: flex; flex-direction: column; gap: 6px; }
.bv-field label { font-size: 15px; font-weight: 500; color: var(--wp--preset--color--charcoal); }
.bv-field input, .bv-field textarea { font: inherit; font-size: 16px; color: var(--wp--preset--color--charcoal); background: #fff; border: 1px solid var(--wp--preset--color--mist); border-radius: 10px; padding: 12px 14px; width: 100%; box-sizing: border-box; transition: border-color .15s ease, box-shadow .15s ease; }
.bv-field textarea { resize: vertical; min-height: 130px; }
.bv-field input:focus, .bv-field textarea:focus { outline: none; border-color: var(--wp--preset--color--cobalt); box-shadow: 0 0 0 3px var(--wp--preset--color--cobalt-pale); }
.bv-field [aria-invalid="true"] { border-color: #B42318; }
.bv-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.bv-form__actions { margin-top: 4px; }
.bv-form__submit { cursor: pointer; border: 0; }
.bv-form__submit[disabled] { opacity: .6; cursor: default; }
.bv-form__note { margin: 0; font-size: 14px; color: var(--wp--preset--color--muted); }
.bv-form__note a { color: inherit; }
.bv-form__status { margin: 0; font-size: 15px; color: var(--wp--preset--color--muted); }
.bv-form__status:empty { display: none; }
.bv-form__status.is-error { color: #B42318; }
.bv-form__done { padding: 8px 0; }
.bv-form__done p { margin: 0 0 6px; }
.bv-form__done-title { font-family: var(--wp--preset--font-family--display); font-weight: 700; font-size: 24px; color: var(--wp--preset--color--charcoal); }
.bv-form-alt { margin-top: 20px !important; font-size: 15px; color: var(--wp--preset--color--muted); }

/* Cal.com booking calendar. */
.bv-cal { width: 100%; min-height: 560px; overflow: auto; }

/* Case study header: title on the left, picture on the right. */
/* Case study cover hero (1.2.1) */
.bv-case-cover { color: var(--wp--preset--color--off-white); }
.bv-case-cover .bv-eyebrow { color: var(--wp--preset--color--cobalt-light); display: flex; align-items: center; gap: 14px; }
.bv-case-cover .bv-eyebrow::before { content: ""; width: 40px; height: 2px; background: currentColor; }
.bv-case-cover .bv-case-cover__title { font-size: clamp(42px, 5.8vw, 88px) !important; line-height: 1.02; letter-spacing: -0.02em; max-width: 15ch; color: var(--wp--preset--color--white); margin-block-start: 18px; }
.bv-case-cover .bv-case-cover__lead { color: rgba(250, 249, 246, .86); max-width: 46ch; margin-block-start: 24px; }
@media (max-width: 781px) {
	.bv-case-cover { min-height: 0 !important; padding-top: 250px !important; background: var(--wp--preset--color--charcoal); }
	.bv-case-cover .wp-block-cover__image-background { height: 300px !important; bottom: auto !important; object-position: 70% 55% !important; }
	.bv-case-cover .wp-block-cover__background { background: linear-gradient(180deg, rgba(32,37,43,0) 0, rgba(32,37,43,.1) 120px, rgba(32,37,43,.85) 240px, #20252B 300px) !important; }
}
/* Case study key facts strip */
.bv-article .wp-block-post-content > .bv-case-facts { gap: 24px 40px; padding-block: 28px; border-block: 1px solid #DDDAD3; margin-block-end: clamp(40px, 5vw, 64px); }
.bv-case-fact > * { margin: 0; }
.bv-case-fact__label { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--wp--preset--color--cobalt); margin-block-end: 8px !important; }
.bv-case-fact__value { font-size: 16px; line-height: 1.45; color: var(--wp--preset--color--charcoal); font-weight: 500; }

/* A button that looks like a text link (used for "Book a call"). */
.bv-linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--wp--preset--color--charcoal); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.bv-linklike:hover { color: var(--wp--preset--color--cobalt); }
/* Service tags (case studies) */
ul.bv-tags { list-style: none; padding: 0; margin-inline: 0; display: flex; flex-wrap: wrap; gap: 10px; }
ul.bv-tags li { margin: 0; padding: 9px 18px; border-radius: 999px; background: var(--wp--preset--color--cobalt-pale); color: var(--wp--preset--color--cobalt); font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: .01em; }
ul.bv-tags li::before { content: none !important; display: none !important; }
.bv-article .wp-block-post-content > ul.bv-tags { margin-block-end: clamp(32px, 4vw, 48px); }
