/*
Theme Name: CargoBridge
Description: Block theme for CargoBridge Logistics, converted from the Lovable design. Colours, fonts and buttons live in theme.json; every page is built from core blocks and ships as a page pattern.
Requires at least: 6.6
Tested up to: 6.8
Requires PHP: 7.4
Version: 1.1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cargobridge
*/

/* ---------------------------------------------------------------
   Base
---------------------------------------------------------------- */
body { margin: 0; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }

/* Sections sit flush against each other (no block gap between them). */
.wp-site-blocks > * { margin-block: 0; }
.wp-block-post-content > .alignfull { margin-block-start: 0; margin-block-end: 0; }

/* Sticky header */
.wp-site-blocks > header.wp-block-template-part { position: sticky; top: 0; z-index: 50; }
.admin-bar .wp-site-blocks > header.wp-block-template-part { top: 32px; }
@media (max-width: 782px) { .admin-bar .wp-site-blocks > header.wp-block-template-part { top: 46px; } }
@media (max-width: 600px) { .admin-bar .wp-site-blocks > header.wp-block-template-part { top: 0; } }

/* Small helpers */
.cb-eyebrow { font-family: var(--wp--preset--font-family--jost); text-transform: uppercase; letter-spacing: 0.28em; font-weight: 500; line-height: 1rem; }
.cb-maxw-xl { max-width: 36rem; }
.cb-maxw-md { max-width: 28rem; }
.cb-muted-70 { opacity: 0.7; }
.cb-muted-60 { opacity: 0.6; }
.cb-muted-65 { opacity: 0.65; }
.cb-muted-80 { opacity: 0.8; }
.cb-muted-90 { opacity: 0.9; }
.wp-block-image.cb-icon,
.wp-block-image.cb-photo { margin: 0; }
.wp-block-image.cb-icon img { display: block; }
.wp-block-image.cb-photo img { display: block; width: 100%; height: auto; border-radius: 0.5rem; box-shadow: var(--wp--preset--shadow--card); }

/* ---------------------------------------------------------------
   Responsive grids (group blocks using the Grid layout)
   Breakpoints match the Lovable/Tailwind ones: sm 640, md 768, lg 1024.
---------------------------------------------------------------- */
.wp-block-group.cb-grid-4,
.wp-block-group.cb-grid-4-md,
.wp-block-group.cb-grid-3-md,
.wp-block-group.cb-grid-2-sm,
.wp-block-group.cb-grid-2-md,
.wp-block-group.cb-grid-2-lg,
.wp-block-group.cb-grid-contact { grid-template-columns: minmax(0, 1fr); }

@media (min-width: 640px) {
	.wp-block-group.cb-grid-4,
	.wp-block-group.cb-grid-2-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
	.wp-block-group.cb-grid-4-md { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.wp-block-group.cb-grid-3-md { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.wp-block-group.cb-grid-2-md { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
	.wp-block-group.cb-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.wp-block-group.cb-grid-2-lg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.wp-block-group.cb-grid-contact { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
}
.wp-block-group.cb-align-center { align-items: center; }
.wp-block-group.cb-align-start { align-items: start; }

/* ---------------------------------------------------------------
   Header
---------------------------------------------------------------- */
.cb-header__inner { min-height: 72px; }
.cb-brand .wp-block-image { margin: 0; }
.cb-brand__mark img { width: 69px; height: 40px; object-fit: contain; display: block; }
.cb-brand__wordmark img { width: 160px; height: auto; display: block; }
.cb-brand__tagline { font-size: 0.55rem; letter-spacing: 0.4em; line-height: 1; opacity: 0.7; }
.cb-brand a:hover { color: inherit; }

.cb-nav .wp-block-navigation-item__content {
	position: relative;
	padding-block: 6px;
	font-family: var(--wp--preset--font-family--jost);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	transition: color 0.15s ease;
}
.cb-nav .wp-block-navigation-item__content:hover,
.cb-nav .wp-block-navigation-item__content:focus { color: var(--wp--preset--color--gold); }
.cb-nav .current-menu-item > .wp-block-navigation-item__content { color: var(--wp--preset--color--gold); }
.cb-nav .current-menu-item > .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 20px;
	height: 2px;
	background: var(--wp--preset--color--gold);
}
/* "Request a quote" menu item rendered as the gold button */
.cb-nav .cb-nav-quote { margin-left: 0.5rem; }
.cb-nav .cb-nav-quote > .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: center;
	height: 44px;
	padding: 0 1.25rem;
	background: var(--wp--preset--color--gold);
	color: var(--wp--preset--color--navy-deep);
	transition: background-color 0.15s ease;
}
.cb-nav .cb-nav-quote > .wp-block-navigation-item__content:hover,
.cb-nav .cb-nav-quote > .wp-block-navigation-item__content:focus {
	background: var(--wp--preset--color--gold-light);
	color: var(--wp--preset--color--navy-deep);
}

/* Burger menu below 1024px (core switches at 600px) */
@media (min-width: 600px) and (max-width: 1023.98px) {
	.cb-nav .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex; }
	.cb-nav .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none; }
}
.cb-nav .wp-block-navigation__responsive-container-open svg,
.cb-nav .wp-block-navigation__responsive-container-close svg { width: 28px; height: 28px; }
/*
 * Open burger menu: a dropdown under the header, like the Lovable site.
 * Core shows a full-screen overlay; here the overlay is transparent over the header
 * (so the logo stays visible), the close button sits where the burger was, and the
 * panel is only as tall as its links. !important is used where core's overlay rules
 * are more specific than a theme selector.
 */
.cb-nav .wp-block-navigation__responsive-container.is-menu-open {
	--navigation-layout-justification-setting: flex-start;
	--navigation-layout-justify: flex-start;
	bottom: auto;
	max-height: 100vh;
	padding: 0 !important;
	background: transparent !important;
	animation: none;
}
/* Hide the burger behind the transparent overlay while the menu is open */
html.has-modal-open .cb-nav .wp-block-navigation__responsive-container-open,
.cb-nav:has(.is-menu-open) .wp-block-navigation__responsive-container-open { visibility: hidden; }
.cb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
	position: relative;
	padding-top: 72px; /* header height */
}
.cb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	position: absolute;
	top: 22px;
	right: var(--wp--style--root--padding-right, 1.5rem);
	color: var(--wp--preset--color--navy-foreground);
}
.cb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	align-items: flex-start !important;
	padding: 1.5rem var(--wp--style--root--padding-right, 1.5rem) 1.5rem var(--wp--style--root--padding-left, 1.5rem) !important;
	border-top: 1px solid rgba(247, 245, 241, 0.15);
	background: var(--wp--preset--color--navy-deep);
	color: var(--wp--preset--color--navy-foreground);
}
.cb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	align-items: flex-start !important;
	gap: 1rem !important;
}
.cb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	align-items: flex-start !important;
}
.cb-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	padding: 6px 0 !important;
	font-size: 0.875rem;
}
.cb-nav .wp-block-navigation__responsive-container.is-menu-open .cb-nav-quote {
	margin: 0.5rem 0 0 !important;
}
.cb-nav .wp-block-navigation__responsive-container.is-menu-open .cb-nav-quote > .wp-block-navigation-item__content {
	display: inline-flex !important;
	align-items: center;
	height: 44px;
	padding: 0 1.25rem !important;
	font-size: 0.75rem;
}

/* ---------------------------------------------------------------
   Page hero (cover block)
---------------------------------------------------------------- */
.cb-hero.wp-block-cover {
	padding: 3rem var(--wp--style--root--padding-right, 1.5rem) 3rem var(--wp--style--root--padding-left, 1.5rem);
	color: var(--wp--preset--color--navy-foreground);
}
.cb-hero .wp-block-cover__inner-container { position: static; color: inherit; }
.cb-hero .wp-block-cover__inner-container > * { position: relative; z-index: 2; }
.cb-hero .wp-block-cover__inner-container > .cb-hero__location {
	position: absolute;
	right: var(--wp--style--root--padding-right, 1.5rem);
	bottom: 1.25rem;
	left: auto;
	z-index: 2;
	margin: 0 !important;
	max-width: none;
}
.cb-hero__title { max-width: 48rem; }
.cb-hero .wp-block-separator.cb-hero__rule {
	width: 4rem;
	height: 1px;
	margin-left: 0 !important;
	margin-right: auto !important;
	border: 0;
	background: currentColor;
	opacity: 1;
}
.cb-hero__text { max-width: 28rem; opacity: 0.9; }

/* ---------------------------------------------------------------
   Buttons (block styles)
---------------------------------------------------------------- */
.wp-block-button .wp-block-button__link { transition: background-color 0.2s ease, filter 0.2s ease, transform 0.2s ease; }
.wp-block-button.is-style-outline-light .wp-block-button__link {
	background: transparent;
	border: 1px solid var(--wp--preset--color--navy-foreground);
	color: var(--wp--preset--color--navy-foreground);
	padding: calc(1rem - 1px) calc(1.5rem - 1px);
}
.wp-block-button.is-style-outline-light .wp-block-button__link:hover,
.wp-block-button.is-style-outline-light .wp-block-button__link:focus {
	background: rgba(247, 245, 241, 0.1);
	color: var(--wp--preset--color--navy-foreground);
}
.wp-block-button.is-style-gold-gradient .wp-block-button__link,
.cb-form-card .wpcf7-submit {
	background: var(--wp--preset--gradient--gold);
	color: var(--wp--preset--color--navy-deep);
	border: 0;
	border-radius: 0.375rem;
	padding: 0.9rem 1.6rem;
	font-family: var(--wp--preset--font-family--jost);
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.25;
	text-transform: uppercase;
	cursor: pointer;
}
.wp-block-button.is-style-gold-gradient .wp-block-button__link:hover,
.wp-block-button.is-style-gold-gradient .wp-block-button__link:focus,
.cb-form-card .wpcf7-submit:hover,
.cb-form-card .wpcf7-submit:focus {
	background: var(--wp--preset--gradient--gold);
	color: var(--wp--preset--color--navy-deep);
	filter: brightness(1.07);
	transform: translateY(-1px);
}

/* ---------------------------------------------------------------
   Content sections
---------------------------------------------------------------- */
.cb-strip { border-top: 1px solid rgba(247, 245, 241, 0.1); }

.cb-more-link a:hover { color: inherit; text-decoration: underline; }

/* Home "What we do" grid with hairline dividers */
.wp-block-group.cb-service-grid {
	gap: 1px;
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 0.5rem;
	background: var(--wp--preset--color--border);
}
.cb-service-cell { padding: 2rem; background: var(--wp--preset--color--card); transition: background-color 0.2s ease; }
.cb-service-cell:hover { background: var(--wp--preset--color--secondary); }

/* Cards */
.cb-card {
	padding: 2rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 0.5rem;
	background: var(--wp--preset--color--card);
}
.cb-card--shadow { box-shadow: var(--wp--preset--shadow--card); }
.cb-card--lift { transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.cb-card--lift:hover {
	transform: translateY(-0.25rem);
	border-color: var(--wp--preset--color--gold);
	box-shadow: var(--wp--preset--shadow--card);
}
.cb-icon-box { flex-shrink: 0; width: 3.5rem; height: 3.5rem; border-radius: 0.375rem; }
.cb-card__body { flex: 1 1 auto; min-width: 0; }

/* Industry pills (whole pill is clickable) */
.cb-pill {
	position: relative;
	padding: 0.75rem 1.25rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 9999px;
	background: var(--wp--preset--color--card);
	transition: border-color 0.2s ease;
}
.cb-pill:hover,
.cb-pill:focus-within { border-color: var(--wp--preset--color--gold); }
.cb-pill a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.cb-pill a:hover,
.cb-pill a:focus { color: inherit; }

/* About values */
.cb-value { padding-left: 1.5rem; border-left: 2px solid var(--wp--preset--color--gold); }

/* Footer */
.cb-footer-list { margin: 0; padding: 0; list-style: none; }
.cb-footer-list li + li { margin-top: 0.5rem; }
.cb-footer__logo img { width: 12rem; border-radius: 0.25rem; }
.cb-footer__bottom { border-top: 1px solid rgba(247, 245, 241, 0.1); text-align: center; }

/* ---------------------------------------------------------------
   Contact Form 7 quote form
---------------------------------------------------------------- */
.cb-form-card { padding: 2rem; }
.cb-form-card .wpcf7 form { margin: 0; }
.cb-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 640px) {
	.cb-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.cb-form-grid .cb-span-2 { grid-column: 1 / -1; }
}
.cb-form-grid .wpcf7-form-control-wrap { display: block; }
.cb-form-card input[type="text"],
.cb-form-card input[type="email"],
.cb-form-card input[type="tel"],
.cb-form-card select,
.cb-form-card textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 0.75rem 1rem;
	border: 1px solid #dcd7cf;
	border-radius: 0.375rem;
	background: var(--wp--preset--color--card);
	color: var(--wp--preset--color--foreground);
	font-family: inherit;
	font-size: 0.875rem;
	line-height: 1.25rem;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cb-form-card textarea { min-height: 8.5rem; resize: vertical; }
.cb-form-card input::placeholder,
.cb-form-card textarea::placeholder { color: var(--wp--preset--color--muted-foreground); opacity: 1; }
.cb-form-card input:focus,
.cb-form-card select:focus,
.cb-form-card textarea:focus {
	border-color: var(--wp--preset--color--gold);
	box-shadow: 0 0 0 3px rgba(196, 129, 57, 0.3);
}
.cb-form-card .cb-submit-row { position: relative; }
.cb-form-card .wpcf7-submit { display: flex; justify-content: center; width: 100%; }
.cb-form-card .wpcf7-spinner { position: absolute; top: 50%; right: 0.75rem; margin: -12px 0 0; }
.cb-form-card .wpcf7-not-valid { border-color: #dc2626; }
.cb-form-card .wpcf7-not-valid-tip { margin-top: 0.35rem; color: #dc2626; font-size: 0.75rem; }
.cb-form-card .wpcf7 form .wpcf7-response-output {
	margin: 1rem 0 0;
	padding: 0.75rem 1rem;
	border-radius: 0.375rem;
	color: var(--wp--preset--color--muted-foreground);
	font-size: 0.875rem;
}

/* ---------------------------------------------------------------
   Home page brand intro (logo splash + staggered hero)
---------------------------------------------------------------- */
@keyframes cb-fade-up { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes cb-zoom { from { transform: scale(1.1); } to { transform: scale(1); } }
@keyframes cb-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes cb-mark { 0% { opacity: 0; transform: scale(0.7); } 60% { opacity: 1; transform: scale(1.04); } 100% { opacity: 1; transform: scale(1); } }
@keyframes cb-splash-out { 0%, 72% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }

.cb-intro-splash {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.5rem;
	background: var(--wp--preset--color--navy-deep);
	pointer-events: none;
	animation: cb-splash-out 2.2s cubic-bezier(0.65, 0, 0.35, 1) 0.35s forwards;
}
.cb-intro-mark { width: 10rem; height: 6rem; object-fit: contain; opacity: 0; animation: cb-mark 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards; }
.cb-intro-wordmark { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; opacity: 0; animation: cb-fade-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.7s forwards; }
.cb-intro-wordmark img { width: 15rem; height: auto; }
.cb-intro-line { display: block; width: 10rem; height: 1px; background: var(--wp--preset--gradient--gold); transform: scaleX(0); animation: cb-line 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.55s forwards; }
.cb-intro-eyebrow { color: var(--wp--preset--color--gold); font-family: var(--wp--preset--font-family--jost); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.28em; text-transform: uppercase; }

body.home .cb-hero--intro .wp-block-cover__image-background { animation: cb-zoom 2.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
body.home .cb-hero--intro .cb-hero__content > * { opacity: 0; animation: cb-fade-up 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
body.home .cb-hero--intro .cb-hero__content > :nth-child(1) { animation-delay: 1.7s; }
body.home .cb-hero--intro .cb-hero__content > :nth-child(2) { animation-delay: 1.85s; }
body.home .cb-hero--intro .cb-hero__content > :nth-child(3) { animation-delay: 1.95s; }
body.home .cb-hero--intro .cb-hero__content > :nth-child(4) { animation-delay: 2s; }
body.home .cb-hero--intro .cb-hero__content > :nth-child(5) { animation-delay: 2.15s; }

/* Intro already seen in this browser session (set by inc/seo.php) */
html.cb-intro-seen .cb-intro-splash { display: none; }
html.cb-intro-seen body.home .cb-hero--intro .cb-hero__content > * { opacity: 1; animation: none; }
html.cb-intro-seen body.home .cb-hero--intro .wp-block-cover__image-background { animation: none; }

@media (prefers-reduced-motion: reduce) {
	.cb-intro-splash { display: none; }
	body.home .cb-hero--intro .cb-hero__content > * { opacity: 1; animation: none; }
	body.home .cb-hero--intro .wp-block-cover__image-background { animation: none; }
	.cb-card--lift:hover, .wp-block-button .wp-block-button__link:hover { transform: none; }
}
