/**
 * Red Marshal Theme - Responsive Styles
 * Mobile-first approach with breakpoints at 640px, 768px, 1024px, 1280px
 *
 * @package Red_Marshal
 */

/* ===========================
   MOBILE STYLES (Base - 320px+)
   =========================== */

/* Already defined in main style.css as mobile-first */

/* Prevent swipe gestures globally on mobile */
@media (max-width: 1024px) {
	html, body {
		touch-action: pan-y pinch-zoom;
		-webkit-user-select: none;
		user-select: none;
		overscroll-behavior-x: none;
	}
	
	* {
		-webkit-touch-callout: none;
	}
}

/* ===========================
   SMALL TABLETS (640px+)
   =========================== */
@media (max-width: 640px) {
	
	/* Typography */
	h1 { font-size: 2rem; }
	h2 { font-size: 1.75rem; }
	h3 { font-size: 1.5rem; }
	
	/* Container */
	.container {
		padding: 0 1rem;
	}
	
	/* Header */
	.header-container {
		padding: 0 1rem;
	}
	
	/* Logo - Constrain for mobile */
	.site-branding {
		max-width: 180px;
	}
	
	.custom-logo {
		max-height: 40px;
	}
	
	.main-navigation {
		position: fixed;
		top: 0;
		right: -100%;
		width: 80%;
		max-width: 300px;
		height: 100vh;
		background: rgba(255, 255, 255, 0.95);
		backdrop-filter: blur(35px);
		-webkit-backdrop-filter: blur(35px);
		flex-direction: column;
		justify-content: center;
		align-items: center;
		padding: var(--spacing-md) var(--spacing-sm);
		box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
		transition: none;
		z-index: 999;
		overflow-y: auto;
		touch-action: none;
		-webkit-touch-callout: none;
		-webkit-user-select: none;
		user-select: none;
	}
	
	.main-navigation.mobile-active {
		right: 0;
	}
	
	.main-navigation ul {
		flex-direction: column;
		width: 100%;
		align-items: center;
		gap: 0.75rem;
	}
	
	.main-navigation li {
		width: 100%;
		text-align: center;
		margin-bottom: 0;
	}
	
	.main-navigation a {
		display: block;
		padding: 0.5rem 0;
		font-size: 1rem;
	}
	
	.mobile-menu-toggle {
		display: block;
	}
	
	.menu-cta-button {
		display: block;
		text-align: center;
		width: 100%;
	}
	
	/* Footer */
	.footer-widgets {
		grid-template-columns: 1fr;
		gap: var(--spacing-lg);
	}
	
	.footer-legal-links {
		flex-direction: column;
		gap: var(--spacing-xs);
	}
	
	/* Properties Grid */
	.properties-grid {
		grid-template-columns: 1fr;
	}
	
	/* Posts Grid */
	.posts-grid {
		grid-template-columns: 1fr;
	}
	
	/* Property Quick Info */
	.property-quick-info {
		grid-template-columns: 1fr 1fr;
		gap: var(--spacing-sm);
	}
	
	.quick-info-item {
		font-size: 0.85rem;
	}
	
	/* Property Content */
	.property-content-wrapper {
		grid-template-columns: 1fr;
		gap: var(--spacing-md);
	}
	
	.property-sidebar {
		position: relative;
		top: 0;
		margin-top: var(--spacing-md);
	}
	
	.contact-card {
		position: relative;
		top: 0;
	}
	
	/* Property Filters */
	.property-filters {
		flex-direction: column;
		gap: var(--spacing-sm);
	}
	
	.filter-group {
		width: 100%;
	}
	
	/* Buttons */
	.btn {
		width: 100%;
		display: block;
	}
	
	/* Property Gallery Hero - Mobile */
	.property-gallery-hero {
		grid-template-columns: 1fr;
		height: auto;
		gap: 4px;
		max-width: 100%;
		width: calc(100% - 2rem);
		margin: 0 auto var(--spacing-md) auto;
		padding: 0 var(--spacing-sm);
		border-radius: 0;
		box-sizing: border-box;
	}
	
	.gallery-main-image {
		grid-row: 1;
		height: auto;
		min-height: 250px;
		aspect-ratio: 16 / 10;
		width: 100%;
	}
	
	.gallery-main-img {
		width: 100%;
		height: 100%;
		object-fit: cover;
	}
	
	.gallery-grid {
		display: none; /* Hide grid on mobile, show in lightbox */
	}
	
	/* Ensure single property page respects container */
	.single-property {
		overflow-x: hidden;
	}
	
	.single-property .property-gallery-hero {
		margin-left: 0;
		margin-right: 0;
	}
	
	.view-all-photos-btn {
		bottom: 10px;
		right: 10px;
		padding: 8px 16px;
		font-size: 0.9rem;
	}
	
	.property-title-section {
		flex-direction: column;
		gap: var(--spacing-sm);
	}
	
	.property-price-highlight {
		font-size: 1.75rem;
	}
	
	/* Lightbox Mobile */
	.lightbox-content {
		padding: 60px 10px 0;
	}
	
	.lightbox-nav {
		width: 40px;
		height: 40px;
	}
	
	.lightbox-prev {
		left: 10px;
	}
	
	.lightbox-next {
		right: 10px;
	}
	
	.lightbox-thumbnails {
		padding: 10px 20px;
	}
	
	.lightbox-thumb {
		width: 60px;
		height: 45px;
	}
	
	.lightbox-header {
		padding: 15px 20px;
	}
	
	/* 404 Error */
	.error-404 h1 {
		font-size: 4rem;
	}
}

/* ===========================
   TABLETS (641px - 768px)
   =========================== */
@media (min-width: 641px) and (max-width: 768px) {
	
	/* Header */
	.main-navigation {
		position: fixed;
		top: 0;
		right: -100%;
		width: 60%;
		max-width: 400px;
		height: 100vh;
		background-color: var(--color-background);
		flex-direction: column;
		padding: var(--spacing-lg) var(--spacing-md);
		box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
		transition: var(--transition);
		z-index: 999;
		overflow-y: auto;
	}
	
	.main-navigation.mobile-active {
		right: 0;
	}
	
	.main-navigation ul {
		flex-direction: column;
	}
	
	.mobile-menu-toggle {
		display: block;
	}
	
	/* Footer */
	.footer-widgets {
		grid-template-columns: repeat(2, 1fr);
	}
	
	/* Properties Grid */
	.properties-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	
	/* Posts Grid */
	.posts-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ===========================
   SMALL LAPTOPS (769px - 1024px)
   =========================== */
@media (min-width: 769px) and (max-width: 1024px) {
	
	/* Header */
	.main-navigation ul {
		gap: var(--spacing-sm);
	}
	
	.main-navigation a {
		font-size: 0.85rem;
	}
	
	/* Footer */
	.footer-widgets {
		grid-template-columns: repeat(2, 1fr);
	}
	
	/* Properties Grid */
	.properties-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ===========================
   DESKTOP (1025px+)
   =========================== */
@media (min-width: 1025px) {
	
	/* Property Content Wrapper */
	.property-content-wrapper {
		display: grid;
		grid-template-columns: 2fr 1fr;
		gap: var(--spacing-lg);
	}
	
	/* Property Quick Info */
	.property-quick-info {
		display: flex;
		gap: var(--spacing-md);
		padding: var(--spacing-md);
		background-color: var(--color-background-alt);
		border-radius: var(--border-radius);
		margin-bottom: var(--spacing-md);
	}
	
	.quick-info-item {
		display: flex;
		align-items: center;
		gap: 0.5rem;
	}
	
	/* Property Filters */
	.property-filters {
		display: flex;
		gap: var(--spacing-sm);
		margin-bottom: var(--spacing-md);
		flex-wrap: wrap;
	}
	
	.filter-group {
		flex: 1;
		min-width: 200px;
	}
	
	/* Stats Grid */
	.stats-grid {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: var(--spacing-md);
	}
}

/* ===========================
   LARGE DESKTOP (1280px+)
   =========================== */
@media (min-width: 1280px) {
	
	/* Properties Grid */
	.properties-grid {
		grid-template-columns: repeat(3, 1fr);
	}
	
	/* Posts Grid */
	.posts-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* ===========================
   UTILITY RESPONSIVE CLASSES
   =========================== */

/* Hide on Mobile */
@media (max-width: 768px) {
	.hide-mobile {
		display: none !important;
	}
}

/* Hide on Desktop */
@media (min-width: 769px) {
	.hide-desktop {
		display: none !important;
	}
}

/* ===========================
   MENU OVERLAY
   =========================== */
body.menu-open {
	overflow: hidden;
}

body.menu-open::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 998;
}

/* ===========================
   PROPERTY HEADER RESPONSIVE
   =========================== */
.property-header {
	position: relative;
	padding: var(--spacing-xl) 0;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	min-height: 400px;
	display: flex;
	align-items: center;
}

.property-header::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(to bottom, rgba(26, 35, 50, 0.7), rgba(26, 35, 50, 0.9));
}

.property-header-content {
	position: relative;
	z-index: 1;
	color: #ffffff;
}

.property-header .property-status {
	background-color: var(--color-gold);
	color: var(--color-primary);
}

.property-header .entry-title {
	color: #ffffff;
}

.property-header .property-location {
	color: rgba(255, 255, 255, 0.9);
}

.property-header .property-price {
	color: var(--color-gold);
}

@media (max-width: 768px) {
	.property-header {
		min-height: 300px;
		padding: var(--spacing-lg) 0;
	}
	
	.property-header .entry-title {
		font-size: 2rem;
	}
}

/* ===========================
   CONTACT CARD RESPONSIVE
   =========================== */
.contact-card {
	background-color: var(--color-background-alt);
	padding: var(--spacing-md);
	border-radius: var(--border-radius);
	position: sticky;
	top: 100px;
}

@media (max-width: 1024px) {
	.contact-card {
		position: relative;
		top: 0;
	}
}

/* ===========================
   ARCHIVE HEADER
   =========================== */
.archive-header {
	text-align: center;
	margin-bottom: var(--spacing-lg);
	padding: var(--spacing-lg) 0;
}

.archive-title {
	margin-bottom: var(--spacing-sm);
}

.archive-description {
	color: var(--color-text-light);
	max-width: 700px;
	margin: 0 auto;
}

/* ===========================
   ERROR LINKS
   =========================== */
.error-links {
	list-style: none;
	padding: 0;
	display: flex;
	gap: var(--spacing-sm);
	justify-content: center;
	flex-wrap: wrap;
}

.error-links li a {
	display: inline-block;
	padding: var(--spacing-xs) var(--spacing-sm);
	background-color: var(--color-background-alt);
	border-radius: var(--border-radius);
	transition: var(--transition);
}

.error-links li a:hover {
	background-color: var(--color-accent);
	color: #ffffff;
}

/* ===========================
   POST NAVIGATION
   =========================== */
.post-navigation {
	margin: var(--spacing-lg) 0;
	padding: var(--spacing-md) 0;
	border-top: 1px solid #eee;
}

.post-navigation .nav-links {
	display: flex;
	justify-content: space-between;
	gap: var(--spacing-md);
}

.post-navigation a {
	flex: 1;
	padding: var(--spacing-sm);
	border: 1px solid #eee;
	border-radius: var(--border-radius);
	transition: var(--transition);
}

.post-navigation a:hover {
	border-color: var(--color-accent);
}

.nav-subtitle {
	display: block;
	font-size: 0.85rem;
	color: var(--color-text-light);
	margin-bottom: 0.25rem;
}

.nav-title {
	display: block;
	font-weight: 600;
}

@media (max-width: 640px) {
	.post-navigation .nav-links {
		flex-direction: column;
	}
}

/* ===========================
   SEARCH FORM
   =========================== */
.search-form {
	display: flex;
	gap: var(--spacing-xs);
	max-width: 500px;
	margin: 0 auto;
}

.search-form input[type="search"] {
	flex: 1;
}

.search-form button {
	padding: 12px 24px;
	background-color: var(--color-accent);
	color: #ffffff;
	border: none;
	border-radius: var(--border-radius);
	cursor: pointer;
	transition: var(--transition);
}

.search-form button:hover {
	background-color: var(--color-accent-hover);
}

/* ===========================
   PRINT STYLES
   =========================== */
@media print {
	.site-header,
	.site-footer,
	.mobile-menu-toggle,
	.property-filters,
	.back-to-top {
		display: none;
	}
	
	body {
		font-size: 12pt;
		line-height: 1.5;
	}
	
	a {
		text-decoration: underline;
	}
	
	.container {
		max-width: 100%;
	}
}
