/*
 * Bách Việt Tribe responsive layer.
 *
 * Loaded after all component/page styles so the rules below normalize the
 * experience across desktop, laptop, tablet and mobile without duplicating
 * page-specific CSS.
 */

/* Base safeguards */
html {
	overflow-x: hidden;
	scroll-padding-top: calc(var(--bvt-header-height) + 18px);
}

body {
	overflow-x: clip;
	min-width: 320px;
}

main,
section,
header,
footer,
nav,
article,
aside,
div {
	min-width: 0;
}

[id] {
	scroll-margin-top: calc(var(--bvt-header-height) + 20px);
}

p,
li,
a,
span,
strong,
small,
label,
h1,
h2,
h3,
h4 {
	overflow-wrap: break-word;
	word-break: normal;
}

input,
textarea,
select,
button {
	max-width: 100%;
}

iframe,
video,
embed,
object {
	display: block;
	width: 100%;
	max-width: 100%;
}

table {
	width: 100%;
	border-collapse: collapse;
}

.bvt-inline-icon {
	flex: 0 0 18px;
	display: inline-block;
	width: 18px;
	height: 18px;
	min-width: 18px;
	max-width: 18px;
	fill: currentColor;
	vertical-align: middle;
}

/* Avoid accidental oversizing from WordPress/editor content */
.bvt-entry-content img,
.bvt-single-project-article img,
.wp-block-image img {
	max-width: 100%;
	height: auto;
}

/* Improve finger-sized controls */
@media (pointer: coarse) {
	.bvt-button,
	.bvt-menu-toggle,
	.bvt-header-phone,
	.bvt-project-filters button,
	.bvt-contact-social-button,
	.bvt-back-to-top,
	.bvt-submenu-toggle {
		min-height: 44px;
	}

	.bvt-menu .sub-menu a,
	.bvt-footer-links a,
	.bvt-contact-field input,
	.bvt-contact-field select {
		min-height: 44px;
	}
}

/* Large laptop: keep content inside common 1200–1366px screens */
@media (max-width: 1280px) {
	:root {
		--bvt-container: 1120px;
	}

	.bvt-header-inner {
		gap: 24px;
	}

	.bvt-menu {
		gap: 28px;
	}

	.bvt-header-cta {
		padding-inline: 18px;
	}

	.bvt-home-hero-grid,
	.bvt-services-hero-grid,
	.bvt-detail-hero-grid,
	.bvt-projects-hero-grid,
	.bvt-contact-hero-grid {
		gap: 38px;
	}

	.bvt-footer-grid {
		gap: 38px;
	}
}

/* Tablet landscape / compact laptop */
@media (max-width: 1080px) {
	:root {
		--bvt-container: 940px;
	}

	/* Mobile drawer is controlled by navigation.js */
	.bvt-primary-navigation {
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
	}

	.bvt-primary-navigation .bvt-menu {
		width: 100%;
	}

	.bvt-primary-navigation .bvt-menu > li > a {
		width: 100%;
	}

	/* Hero layouts */
	.bvt-home-hero-grid,
	.bvt-services-hero-grid,
	.bvt-detail-hero-grid,
	.bvt-projects-hero-grid,
	.bvt-contact-hero-grid {
		grid-template-columns: minmax(0, 1fr) minmax(330px, .72fr);
		gap: 30px;
	}

	.bvt-home-hero h1,
	.bvt-services-hero h1,
	.bvt-detail-hero h1,
	.bvt-projects-hero h1,
	.bvt-contact-hero h1 {
		font-size: clamp(36px, 5.2vw, 52px);
	}

	/* Make card grids comfortable on tablets */
	.bvt-service-grid,
	.bvt-project-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bvt-benefit-grid,
	.bvt-detail-benefits-grid,
	.bvt-contact-reasons-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bvt-form-grid,
	.bvt-contact-form-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bvt-footer-cta-inner {
		gap: 36px;
	}
}

/* Tablet portrait */
@media (max-width: 900px) {
	:root {
		--bvt-container: 760px;
	}

	/* All major hero areas become one-column. Text always appears first. */
	.bvt-home-hero-grid,
	.bvt-services-hero-grid,
	.bvt-detail-hero-grid,
	.bvt-projects-hero-grid,
	.bvt-contact-hero-grid,
	.bvt-single-project-hero-grid {
		grid-template-columns: 1fr !important;
	}

	.bvt-home-hero-copy,
	.bvt-services-hero-copy,
	.bvt-detail-hero-copy,
	.bvt-projects-hero-copy,
	.bvt-contact-hero-copy {
		max-width: 760px;
	}

	.bvt-home-hero-visual,
	.bvt-services-hero-visual,
	.bvt-contact-hero-visual {
		order: 2;
		min-height: 320px;
	}

	.bvt-detail-hero-image,
	.bvt-single-project-cover {
		order: 2;
		min-height: 360px;
	}

	.bvt-projects-hero-visual {
		order: 2;
		min-height: 350px;
	}

	/* Main page grids */
	.bvt-benefits-layout,
	.bvt-home-contact-grid,
	.bvt-services-summary-grid,
	.bvt-contact-main-grid,
	.bvt-project-guidance-grid,
	.bvt-detail-inner-cta-grid,
	.bvt-single-project-content-grid {
		grid-template-columns: 1fr !important;
	}

	.bvt-contact-connect-panel {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bvt-home-form-wrap {
		max-width: 760px;
	}

	/* Services list cards */
	.bvt-service-feature,
	.bvt-service-feature.is-reversed {
		grid-template-columns: 1fr !important;
	}

	.bvt-service-feature.is-reversed .bvt-service-feature-image {
		order: 0;
	}

	.bvt-service-feature-image {
		min-height: 280px;
		aspect-ratio: 16 / 8.8;
	}

	/* Process grids */
	.bvt-process-grid,
	.bvt-services-process-grid,
	.bvt-detail-process-grid,
	.bvt-project-method-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	/* Footer */
	.bvt-footer-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bvt-footer-contact {
		grid-column: 1 / -1;
	}

	.bvt-footer-cta-inner {
		grid-template-columns: 1fr;
	}

	/* Dashboard */
	.bvt-dashboard-visuals {
		grid-template-columns: 1fr;
	}

	.bvt-dashboard-chart {
		border-right: 0;
		border-bottom: 1px solid rgba(138,103,40,.13);
	}

	/* Project detail */
	.bvt-single-project-aside {
		position: static;
	}

	/* Long admin/page content */
	.bvt-entry-content table,
	.bvt-single-project-article table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* WordPress tablet breakpoint and smaller */
@media (max-width: 782px) {
	:root {
		--bvt-container: 700px;
	}

	.admin-bar .bvt-site-header {
		top: 46px;
	}

	.bvt-header-inner {
		min-height: var(--bvt-header-height);
	}

	.bvt-brand-name {
		max-width: 190px;
		white-space: normal;
	}

	.bvt-footer-bottom p {
		max-width: 100%;
	}

	/* Contact info and proof bars */
	.bvt-contact-info-strip,
	.bvt-projects-proof-strip {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bvt-contact-info-strip article:nth-child(2n),
	.bvt-projects-proof-strip > div:nth-child(2n) {
		border-right: 0;
	}

	.bvt-contact-info-strip article:nth-child(-n+2),
	.bvt-projects-proof-strip > div:nth-child(-n+2) {
		border-bottom: 1px solid rgba(138,103,40,.12);
	}

	.bvt-dashboard-metrics {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bvt-dashboard-metric:nth-child(2n) {
		border-right: 0;
	}
}

/* Large phones / small tablets */
@media (max-width: 700px) {
	:root {
		--bvt-container: 640px;
		--bvt-section-space: 64px;
	}

	body {
		font-size: 15px;
	}

	.bvt-container {
		width: min(calc(100% - 28px), var(--bvt-container));
	}

	/* Consistent vertical rhythm */
	.bvt-home-section,
	.bvt-services-list-section,
	.bvt-services-process,
	.bvt-detail-section,
	.bvt-projects-list-section,
	.bvt-project-method,
	.bvt-contact-main-section,
	.bvt-contact-reasons,
	.bvt-project-guidance,
	.bvt-single-project-content {
		padding-block: 64px;
	}

	.bvt-home-hero,
	.bvt-services-hero,
	.bvt-detail-hero,
	.bvt-projects-hero,
	.bvt-contact-hero,
	.bvt-single-project-hero {
		padding-top: 42px;
	}

	.bvt-home-hero h1,
	.bvt-services-hero h1,
	.bvt-detail-hero h1,
	.bvt-projects-hero h1,
	.bvt-contact-hero h1,
	.bvt-single-project h1 {
		font-size: clamp(32px, 9vw, 46px);
		line-height: 1.2;
	}

	.bvt-home-section-heading,
	.bvt-services-heading,
	.bvt-detail-heading,
	.bvt-projects-heading,
	.bvt-contact-heading {
		margin-bottom: 30px;
		text-align: left;
	}

	.bvt-home-section-heading h2,
	.bvt-services-heading h2,
	.bvt-detail-heading h2,
	.bvt-projects-heading h2,
	.bvt-contact-heading h2,
	.bvt-project-guidance h2,
	.bvt-detail-inner-cta h2 {
		font-size: clamp(25px, 7vw, 36px);
	}

	/* CTAs become full-width and easier to tap */
	.bvt-home-hero-actions,
	.bvt-services-hero-actions,
	.bvt-detail-actions,
	.bvt-projects-hero-actions,
	.bvt-contact-hero-actions {
		display: grid;
		grid-template-columns: 1fr;
		width: 100%;
	}

	.bvt-home-hero-actions .bvt-button,
	.bvt-services-hero-actions .bvt-button,
	.bvt-detail-actions .bvt-button,
	.bvt-projects-hero-actions .bvt-button,
	.bvt-contact-hero-actions .bvt-button {
		width: 100%;
	}

	/* Cards and forms become one column */
	.bvt-service-grid,
	.bvt-project-grid,
	.bvt-benefit-grid,
	.bvt-detail-needs-grid,
	.bvt-detail-scope-grid,
	.bvt-detail-benefits-grid,
	.bvt-detail-process-grid,
	.bvt-project-method-grid,
	.bvt-contact-reasons-grid,
	.bvt-detail-faq-grid,
	.bvt-form-grid,
	.bvt-contact-form-grid,
	.bvt-footer-grid,
	.bvt-single-project-summary-grid,
	.bvt-single-project-meta {
		grid-template-columns: 1fr !important;
	}

	.bvt-contact-field.is-full {
		grid-column: auto;
	}

	.bvt-contact-connect-panel {
		grid-template-columns: 1fr;
	}

	.bvt-process-grid,
	.bvt-services-process-grid {
		grid-template-columns: 1fr;
	}

	.bvt-process-step::after,
	.bvt-services-process-step::after,
	.bvt-detail-process-card::after,
	.bvt-project-method-grid article::after {
		display: none !important;
	}

	/* Improve card density */
	.bvt-service-feature-content,
	.bvt-contact-form-panel,
	.bvt-contact-connect-card {
		padding: 28px 22px;
	}

	.bvt-service-card,
	.bvt-benefit-card,
	.bvt-detail-need-card,
	.bvt-detail-scope-card,
	.bvt-detail-benefit-card,
	.bvt-project-card-body,
	.bvt-process-step,
	.bvt-services-process-step,
	.bvt-detail-process-card,
	.bvt-project-method-grid article {
		min-height: 0;
	}

	.bvt-service-feature-list {
		grid-template-columns: 1fr;
	}

	.bvt-detail-benefit-card {
		align-items: flex-start;
	}

	/* Dashboard collapses cleanly */
	.bvt-dashboard-metrics {
		grid-template-columns: 1fr;
	}

	.bvt-dashboard-metric {
		border-right: 0 !important;
		border-bottom: 1px solid rgba(138,103,40,.13);
	}

	.bvt-dashboard-metric:last-child {
		border-bottom: 0;
	}

	.bvt-dashboard-chart {
		min-height: 250px;
		padding: 22px;
	}

	.bvt-dashboard-grid-lines {
		inset: 22px;
	}

	.bvt-dashboard-chart svg {
		inset: 38px 28px 30px;
		width: calc(100% - 56px);
		height: calc(100% - 68px);
	}

	/* Horizontal filter remains usable */
	.bvt-project-filters {
		justify-content: flex-start;
		flex-wrap: nowrap;
		overflow-x: auto;
		padding: 0 0 10px;
		scrollbar-width: thin;
		-webkit-overflow-scrolling: touch;
	}

	.bvt-project-filters button {
		flex: 0 0 auto;
	}

	/* Contact/proof bars */
	.bvt-contact-info-strip,
	.bvt-projects-proof-strip {
		grid-template-columns: 1fr;
	}

	.bvt-contact-info-strip article,
	.bvt-projects-proof-strip > div {
		border-right: 0 !important;
		border-bottom: 1px solid rgba(138,103,40,.12);
	}

	.bvt-contact-info-strip article:last-child,
	.bvt-projects-proof-strip > div:last-child {
		border-bottom: 0;
	}

	/* Footer */
	.bvt-footer-contact {
		grid-column: auto;
	}

	.bvt-footer-cta-actions {
		width: 100%;
	}

	.bvt-footer-cta-actions .bvt-button {
		width: 100%;
	}

	.bvt-footer-brand p {
		max-width: none;
	}
}

/* Standard phones */
@media (max-width: 540px) {
	:root {
		--bvt-header-height: 68px;
	}

	.bvt-container {
		width: min(calc(100% - 24px), var(--bvt-container));
	}

	.bvt-header-inner {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 8px;
	}

	.bvt-brand-link {
		gap: 8px;
	}

	.bvt-brand-mark {
		width: 38px;
		height: 38px;
	}

	.bvt-brand-name {
		max-width: 150px;
		font-size: 10px;
		line-height: 1.25;
	}

	.bvt-header-phone,
	.bvt-menu-toggle {
		width: 40px;
		height: 40px;
	}

	.bvt-primary-navigation {
		width: min(92vw, 390px);
	}

	.bvt-home-hero-visual,
	.bvt-services-hero-visual,
	.bvt-contact-hero-visual {
		min-height: 245px;
	}

	.bvt-detail-hero-image,
	.bvt-single-project-cover {
		min-height: 260px;
	}

	.bvt-projects-hero-visual {
		min-height: 285px;
	}

	.bvt-home-drum-pattern,
	.bvt-services-drum,
	.bvt-contact-rings {
		width: 250px;
		height: 250px;
	}

	.bvt-home-hero-visual img,
	.bvt-services-hero-visual img,
	.bvt-contact-hero-visual img {
		width: min(100%, 275px);
	}

	.bvt-service-feature-image {
		min-height: 220px;
	}

	.bvt-detail-proof-row {
		display: grid;
		grid-template-columns: 1fr;
	}

	.bvt-contact-social-actions {
		grid-template-columns: 1fr;
	}

	.bvt-contact-map-card {
		min-height: 240px;
	}

	.bvt-footer-cta {
		padding-block: 42px;
	}

	.bvt-footer-cta h2 {
		font-size: clamp(24px, 7vw, 31px);
	}

	.bvt-cta-phone {
		font-size: 18px;
	}

	.bvt-back-to-top {
		right: max(12px, env(safe-area-inset-right));
		bottom: max(12px, env(safe-area-inset-bottom));
	}
}

/* Narrow phones: 320–420px */
@media (max-width: 420px) {
	.bvt-brand-name {
		max-width: 118px;
		font-size: 9px;
	}

	.bvt-header-phone {
		display: none;
	}

	.bvt-menu-toggle {
		flex: 0 0 40px;
	}

	.bvt-primary-navigation {
		width: 100vw;
	}

	.bvt-button {
		padding-inline: 15px;
		font-size: 12px;
	}

	.bvt-home-hero h1,
	.bvt-services-hero h1,
	.bvt-detail-hero h1,
	.bvt-projects-hero h1,
	.bvt-contact-hero h1,
	.bvt-single-project h1 {
		font-size: clamp(29px, 9.5vw, 39px);
	}

	.bvt-home-hero-lead,
	.bvt-services-hero-lead,
	.bvt-detail-hero-lead,
	.bvt-projects-hero-lead,
	.bvt-contact-hero-lead {
		font-size: 14px;
	}

	.bvt-service-feature-content,
	.bvt-contact-form-panel,
	.bvt-contact-connect-card,
	.bvt-project-card-body {
		padding-inline: 18px;
	}

	.bvt-detail-scope-card,
	.bvt-detail-need-card,
	.bvt-detail-benefit-card {
		padding-inline: 18px;
	}

	.bvt-contact-info-strip article,
	.bvt-projects-proof-strip > div {
		padding-inline: 17px;
	}

	.bvt-footer-grid {
		padding-top: 48px;
	}
}

/* Mobile landscape: preserve usable vertical space */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 950px) {
	:root {
		--bvt-header-height: 62px;
	}

	.bvt-brand-mark {
		width: 36px;
		height: 36px;
	}

	.bvt-primary-navigation {
		top: var(--bvt-header-height);
		height: calc(100dvh - var(--bvt-header-height));
	}

	.admin-bar .bvt-primary-navigation {
		top: calc(var(--bvt-header-height) + 32px);
		height: calc(100dvh - var(--bvt-header-height) - 32px);
	}

	.bvt-home-hero,
	.bvt-services-hero,
	.bvt-detail-hero,
	.bvt-projects-hero,
	.bvt-contact-hero {
		min-height: 0;
	}
}

/* Hover-only motion should not run on touch devices */
@media (hover: none) {
	.bvt-button:hover,
	.bvt-service-card:hover,
	.bvt-project-card:hover,
	.bvt-detail-need-card:hover {
		transform: none;
	}

	.bvt-service-feature:hover .bvt-service-feature-image img,
	.bvt-project-card:hover .bvt-project-card-image img {
		transform: none;
	}
}

/* Support safe areas on edge-to-edge mobile screens */
@supports (padding: max(0px)) {
	.bvt-site-header .bvt-header-inner,
	.bvt-site-footer .bvt-footer-grid,
	.bvt-footer-cta .bvt-footer-cta-inner {
		padding-left: max(0px, env(safe-area-inset-left));
		padding-right: max(0px, env(safe-area-inset-right));
	}
}

/* Respect user accessibility preferences */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.bvt-home-hero-visual img,
	.bvt-services-hero-visual img {
		animation: none !important;
	}
}

/* Print: remove navigation and decorative CTA */
@media print {
	.bvt-site-header,
	.bvt-footer-cta,
	.bvt-site-footer,
	.bvt-back-to-top,
	.bvt-menu-backdrop {
		display: none !important;
	}

	.bvt-site-main {
		min-height: 0;
	}

	body {
		background: #fff;
		color: #000;
	}

	a {
		text-decoration: underline;
	}
}


/* v1.1.1: lock list icon dimensions on non-home templates. */
.bvt-detail-scope-card li svg,
.bvt-project-guidance li svg,
.bvt-contact-connect-card li svg,
.bvt-detail-proof-row svg,
.bvt-contact-assurances svg {
	flex: 0 0 18px;
	display: block;
	width: 18px;
	height: 18px;
	min-width: 18px;
	max-width: 18px;
}

.bvt-detail-scope-card li > span,
.bvt-project-guidance li > span,
.bvt-contact-connect-card li > span {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: break-word;
	word-break: normal;
}

/* Long technical strings may break, regular Vietnamese copy should not. */
a[href^="mailto:"],
.bvt-contact-info-strip a,
.bvt-footer-contact a {
	overflow-wrap: anywhere;
}
