/**
 * Havenlytics Realty — Production polish layer (v1.4.0)
 * Fixes typography, header/footer, templates, and responsive behavior.
 */

/* ==========================================================================
   PHASE 1 — Typography
   ========================================================================== */

body {
	font-family: var(--hvn-font-body, var(--hvn-theme-font-family-base, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif));
	font-size: var(--hvn-font-size, var(--hvn-theme-font-size-md, 16px));
	line-height: var(--hvn-line-height, 1.6);
	color: var(--hvn-text, var(--hvn-theme-text-primary));
	background-color: var(--hvn-bg, var(--hvn-theme-color-bg-light));
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.hvn-theme-page-title,
.hvn-theme-post-card-title,
.hvn-theme-single-title,
.entry-title {
	font-family: var(--hvn-font-heading, var(--hvn-theme-font-family-heading, 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif));
	font-weight: var(--hvn-theme-font-weight-semibold, 600);
	line-height: var(--hvn-theme-line-height-tight, 1.2);
	color: var(--hvn-text, var(--hvn-theme-text-primary));
}

h1 { margin: 0 0 1rem; }
h2 { margin: 0 0 0.875rem; }
h3 { margin: 0 0 0.75rem; }
h4, h5, h6 { margin: 0 0 0.5rem; }

p {
	margin: 0 0 1rem;
}

.hvn-theme-post-content p:last-child,
.entry-content p:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   PHASE 2 — Header (critical responsive + CTA fix)
   ========================================================================== */

.hvn-theme-header-row {
	position: relative;
}

.hvn-theme-nav,
#site-navigation {
	display: flex;
	align-items: center;
	flex: 1;
	min-width: 0;
}

.hvn-theme-nav-menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.hvn-theme-nav-menu > li > a {
	display: inline-flex;
	align-items: center;
	padding: 0.5rem 0;
	font-size: var(--hvn-theme-font-size-sm, 0.875rem);
	font-weight: var(--hvn-theme-font-weight-medium, 500);
	color: var(--hvn-text, var(--hvn-theme-text-primary));
	text-decoration: none;
	white-space: nowrap;
	transition: color var(--hvn-theme-transition-fast, 150ms ease);
}

.hvn-theme-nav-menu > li > a:hover,
.hvn-theme-nav-menu > li > a:focus,
.hvn-theme-nav-menu > li.current-menu-item > a {
	color: var(--hvn-primary, var(--hvn-theme-brand-primary));
}

.hvn-theme-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-shrink: 0;
	margin-left: auto;
}

.hvn-theme-menu-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	border-radius: var(--hvn-radius, 8px);
}

.hvn-theme-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--hvn-text, var(--hvn-theme-text-primary));
	cursor: pointer;
	border-radius: var(--hvn-radius, 8px);
}

.hvn-theme-header-cta {
	display: none;
	align-items: center;
	justify-content: center;
	padding: 0.625rem 1.25rem;
	font-size: var(--hvn-theme-font-size-sm, 0.875rem);
	font-weight: var(--hvn-theme-font-weight-semibold, 600);
	white-space: nowrap;
	border-radius: var(--hvn-radius, var(--hvn-theme-border-radius-md));
	background: var(--hvn-primary, var(--hvn-theme-brand-primary));
	color: var(--hvn-theme-color-white, #fff);
	text-decoration: none;
	line-height: 1.4;
	transition: background var(--hvn-theme-transition-fast, 150ms ease), transform var(--hvn-theme-transition-fast, 150ms ease);
}

.hvn-theme-header-cta:hover,
.hvn-theme-header-cta:focus {
	background: var(--hvn-theme-brand-primary-dark, #5a4ee6);
	color: var(--hvn-theme-color-white, #fff);
	text-decoration: none;
	transform: translateY(-1px);
}

body:not(.hvn-header-no-cta) .hvn-theme-header-cta {
	display: inline-flex;
}

.hvn-theme-mobile-menu-cta {
	padding: 1rem 1.25rem 1.5rem;
	border-top: 1px solid var(--hvn-border, var(--hvn-theme-border-color));
	margin-top: auto;
}

.hvn-theme-mobile-header-cta {
	width: 100%;
}

@media (max-width: 991px) {
	.hvn-theme-nav,
	#site-navigation,
	.hvn-theme-main-navigation {
		display: none !important;
	}

	.hvn-theme-menu-toggle {
		display: inline-flex !important;
	}

	body:not(.hvn-header-no-cta) .hvn-theme-header-cta {
		display: none !important;
	}

	.hvn-header-layout-2 .hvn-theme-actions,
	.hvn-header-layout-2 .hvn-theme-header-actions {
		position: static;
		transform: none;
		top: auto;
		right: auto;
	}

	.hvn-theme-header-row {
		flex-wrap: nowrap;
		gap: 0.75rem;
		min-height: var(--hvn-theme-header-height-mobile, 60px);
	}

	.hvn-header-layout-2 .hvn-theme-header-row {
		flex-wrap: nowrap;
		justify-content: space-between;
	}

	.hvn-header-layout-2 .hvn-theme-logo,
	.hvn-header-layout-2 .hvn-theme-site-branding {
		flex: 0 1 auto;
		text-align: left;
	}

	.hvn-header-layout-3 .hvn-theme-nav {
		display: none !important;
	}
}

@media (min-width: 992px) {
	.hvn-theme-nav,
	#site-navigation {
		display: flex !important;
	}

	.hvn-theme-menu-toggle {
		display: none !important;
	}

	.hvn-theme-mobile-menu,
	.hvn-theme-mobile-overlay,
	.hvn-theme-mobile-menu-cta {
		display: none !important;
	}

	body:not(.hvn-header-no-cta) .hvn-theme-header-cta {
		display: inline-flex !important;
	}
}

.hvn-theme-mobile-menu {
	display: flex;
	flex-direction: column;
}

.hvn-theme-mobile-menu[aria-hidden="true"] {
	pointer-events: none;
}

.hvn-theme-mobile-menu.active {
	pointer-events: auto;
}

/* ==========================================================================
   PHASE 3 — Footer
   ========================================================================== */

.hvn-theme-footer {
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.hvn-theme-footer-widgets {
	align-items: start;
}

.hvn-theme-footer-widget-title {
	font-family: var(--hvn-font-heading, var(--hvn-theme-font-family-heading));
	font-size: var(--hvn-theme-font-size-lg, 1.125rem);
	font-weight: var(--hvn-theme-font-weight-semibold, 600);
	margin: 0 0 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 2px solid var(--hvn-primary, var(--hvn-theme-brand-primary));
	color: var(--hvn-theme-color-white, #fff);
}

.hvn-theme-footer-widget,
.hvn-theme-footer-widget p,
.hvn-theme-footer-widget li {
	font-size: var(--hvn-theme-font-size-sm, 0.875rem);
	line-height: 1.6;
}

.hvn-theme-footer-bottom {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (min-width: 768px) {
	.hvn-theme-footer-bottom {
		flex-direction: row;
		justify-content: space-between;
		text-align: left;
	}

	.hvn-theme-footer-bottom .hvn-theme-copyright {
		text-align: left;
	}

	.hvn-theme-footer-bottom .hvn-theme-credit {
		text-align: right;
	}
}

/* ==========================================================================
   PHASE 4 — Blog, archive, single, search, pages
   ========================================================================== */

.hvn-theme-container {
	width: 100%;
	max-width: var(--hvn-container, var(--hvn-theme-container-max-width));
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--hvn-theme-container-padding, 1rem);
	padding-right: var(--hvn-theme-container-padding, 1rem);
}

.hvn-theme-posts-grid {
	gap: 1.5rem;
	margin-bottom: 2rem;
}

.hvn-theme-posts-grid .hvn-theme-post-card {
	margin-bottom: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: var(--hvn-theme-color-white, #fff);
	border: 1px solid var(--hvn-border, var(--hvn-theme-border-color));
	border-radius: var(--hvn-radius, var(--hvn-theme-border-radius-lg));
	box-shadow: var(--hvn-theme-shadow-sm);
	overflow: hidden;
	transition: box-shadow var(--hvn-theme-transition-base, 300ms ease), transform var(--hvn-theme-transition-base, 300ms ease);
}

.hvn-theme-posts-grid .hvn-theme-post-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--hvn-theme-shadow-lg);
}

.hvn-theme-post-card-image {
	aspect-ratio: 16 / 9;
	background: var(--hvn-theme-color-gray-100);
}

.hvn-theme-post-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hvn-theme-post-category {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	z-index: 1;
}

.hvn-theme-post-category a {
	display: inline-block;
	padding: 0.25rem 0.625rem;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: var(--hvn-theme-color-white);
	background: var(--hvn-primary, var(--hvn-theme-brand-primary));
	border-radius: var(--hvn-radius, 8px);
	text-decoration: none;
}

.hvn-theme-post-card-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 1.25rem;
}

.hvn-theme-post-card-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	margin-bottom: 0.75rem;
	font-size: 0.8125rem;
	color: var(--hvn-theme-text-muted);
}

.hvn-theme-post-card-meta span {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
}

.hvn-theme-post-card-title {
	font-size: 1.125rem;
	margin: 0 0 0.625rem;
	line-height: 1.35;
}

.hvn-theme-post-card-title a {
	color: inherit;
	text-decoration: none;
}

.hvn-theme-post-card-title a:hover {
	color: var(--hvn-primary, var(--hvn-theme-brand-primary));
}

.hvn-theme-post-card-excerpt {
	flex: 1;
	font-size: 0.9375rem;
	line-height: 1.6;
	color: var(--hvn-theme-text-secondary);
	margin-bottom: 1rem;
}

.hvn-theme-post-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-top: auto;
	padding-top: 0.75rem;
	border-top: 1px solid var(--hvn-border, var(--hvn-theme-border-color));
}

.hvn-theme-read-more {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--hvn-primary, var(--hvn-theme-brand-primary));
	text-decoration: none;
}

.hvn-theme-read-more:hover {
	text-decoration: underline;
}

.hvn-theme-posts-list {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.hvn-theme-posts-list .hvn-theme-post-card {
	margin-bottom: 0;
}

@media (min-width: 768px) {
	.hvn-theme-posts-list .hvn-theme-post-card {
		display: grid;
		grid-template-columns: 280px 1fr;
	}
}

.hvn-theme-single-content {
	background: var(--hvn-theme-color-white);
	border: 1px solid var(--hvn-border, var(--hvn-theme-border-color));
	border-radius: var(--hvn-radius, var(--hvn-theme-border-radius-lg));
	padding: clamp(1.25rem, 3vw, 2.5rem);
	box-shadow: var(--hvn-theme-shadow-sm);
}

.hvn-theme-single-content .entry-title,
.hvn-theme-single-title {
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	margin-bottom: 1rem;
}

.hvn-theme-single-content .entry-meta,
.hvn-theme-entry-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.25rem;
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--hvn-border, var(--hvn-theme-border-color));
	font-size: 0.875rem;
	color: var(--hvn-theme-text-muted);
}

.hvn-theme-single-content .entry-meta span {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
}

.hvn-theme-post-content,
.hvn-theme-single-content .entry-content {
	max-width: 72ch;
	line-height: 1.75;
	font-size: 1.0625rem;
}

.hvn-theme-post-content h2,
.hvn-theme-post-content h3,
.hvn-theme-post-content h4 {
	margin-top: 2rem;
	margin-bottom: 0.75rem;
}

.hvn-theme-single-featured-image {
	border-radius: var(--hvn-radius, var(--hvn-theme-border-radius-lg));
	overflow: hidden;
	margin-bottom: 1.5rem;
}

.hvn-theme-single-featured-image img {
	width: 100%;
	height: auto;
	display: block;
}

.hvn-theme-page .entry-title.hvn-theme-page-title {
	font-size: clamp(1.75rem, 4vw, 2.25rem);
	margin-bottom: 1.25rem;
}

.hvn-theme-page .entry-title.hvn-theme-page-title::after {
	display: none;
}

.hvn-theme-search-header {
	text-align: center;
	padding: 2rem 1.5rem;
	margin-bottom: 2rem;
	background: var(--hvn-theme-color-white);
	border: 1px solid var(--hvn-border, var(--hvn-theme-border-color));
	border-radius: var(--hvn-radius, var(--hvn-theme-border-radius-lg));
}

.hvn-theme-search-title {
	font-size: clamp(1.375rem, 3vw, 1.875rem);
	margin: 0.75rem 0;
}

.hvn-theme-search-title .search-query {
	color: var(--hvn-primary, var(--hvn-theme-brand-primary));
}

.hvn-theme-search-count {
	font-size: 0.875rem;
	color: var(--hvn-theme-text-muted);
	margin-bottom: 1rem;
}

.hvn-theme-search-inline .search-form,
.hvn-theme-no-results-search .search-form {
	display: flex;
	gap: 0.5rem;
	max-width: 480px;
	margin: 0 auto;
}

.hvn-theme-search-inline .search-field,
.hvn-theme-no-results-search .search-field {
	flex: 1;
	min-height: 44px;
	padding: 0.5rem 1rem;
	border: 1px solid var(--hvn-border, var(--hvn-theme-border-color));
	border-radius: var(--hvn-radius, 8px);
	font-family: inherit;
	font-size: 1rem;
}

.hvn-theme-no-results-modern {
	border: 1px solid var(--hvn-border, var(--hvn-theme-border-color));
}

.hvn-theme-no-results-suggestions li::before {
	content: "→";
}

.hvn-theme-page-header {
	margin-bottom: 2rem;
}

.hvn-theme-page-header .hvn-theme-page-title::after {
	display: block;
}

/* ==========================================================================
   PHASE 5 — Global consistency
   ========================================================================== */

.hvn-theme-btn,
.wp-block-button__link {
	background: var(--hvn-primary, var(--hvn-theme-brand-primary));
	border-radius: var(--hvn-radius, var(--hvn-theme-border-radius-md));
	font-family: var(--hvn-font-body, var(--hvn-theme-font-family-base));
}

.hvn-theme-btn:hover,
.hvn-theme-btn:focus,
.wp-block-button__link:hover,
.wp-block-button__link:focus {
	background: var(--hvn-theme-brand-primary-dark, #5a4ee6);
}

a {
	color: var(--hvn-primary, var(--hvn-theme-brand-primary));
}

a:hover,
a:focus {
	color: var(--hvn-theme-brand-primary-dark, #5a4ee6);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
textarea,
select {
	width: 100%;
	max-width: 100%;
	padding: var(--hvn-theme-input-padding, 0.5rem 0.75rem);
	border: 1px solid var(--hvn-border, var(--hvn-theme-border-color));
	border-radius: var(--hvn-radius, var(--hvn-theme-border-radius-sm));
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	background: var(--hvn-theme-color-white);
	color: var(--hvn-text, var(--hvn-theme-text-primary));
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--hvn-primary, var(--hvn-theme-brand-primary));
	box-shadow: 0 0 0 3px rgba(108, 96, 254, 0.15);
}

/* Blog pagination — see layouts.css (.hvn-theme-pagination) */

/* ==========================================================================
   PHASE 6 — Responsive layout grid
   ========================================================================== */

@media (max-width: 991px) {
	.hvn-theme-row {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}

	.hvn-theme-content-area,
	.hvn-theme-sidebar-area,
	.hvn-theme-sidebar-left .hvn-theme-content-area,
	.hvn-theme-sidebar-left .hvn-theme-sidebar-area {
		grid-column: span 12 !important;
		order: unset !important;
	}

	.hvn-theme-posts-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}

	.hvn-theme-single-content {
		padding: 1.25rem;
	}
}

@media (max-width: 767px) {
	.hvn-theme-posts-grid {
		grid-template-columns: 1fr !important;
	}

	.hvn-theme-posts-list .hvn-theme-post-card {
		grid-template-columns: 1fr;
	}

	.hvn-theme-footer-widgets {
		grid-template-columns: 1fr !important;
	}

	.hvn-theme-search-header {
		padding: 1.5rem 1rem;
	}

	.hvn-theme-search-inline .search-form,
	.hvn-theme-no-results-search .search-form {
		flex-direction: column;
	}
}

@media (min-width: 992px) {
	.hvn-theme-posts-grid {
		gap: 2rem;
	}
}
