/**
 * Accessibility & Responsive Enhancements for Bitmaster Theme
 * Add to theme's style.css or create accessibility.css
 */

/* ==========================================================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================================================== */

/* Skip Link */
.skip-link {
	position: absolute;
	left: -9999px;
	z-index: 999999;
	padding: 1em;
	background: var(--wp--preset--color--primary);
	color: white;
	text-decoration: none;
}

.skip-link:focus {
	position: absolute;
	left: 6px;
	top: 6px;
	border-radius: 6px;
	outline: 3px solid var(--wp--preset--color--primary-700);
	outline-offset: 2px;
}

/* Focus States - WCAG AA Compliant */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
	outline: 3px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Remove outline for mouse users */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
	outline: none;
}

/* Keyboard focus only */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
	outline: 3px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* Link Underlines on Hover/Focus */
.entry-content a:not(.wp-block-button__link),
.wp-block-post-content a:not(.wp-block-button__link) {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
	transition: all 0.2s ease;
}

.entry-content a:not(.wp-block-button__link):hover,
.entry-content a:not(.wp-block-button__link):focus,
.wp-block-post-content a:not(.wp-block-button__link):hover,
.wp-block-post-content a:not(.wp-block-button__link):focus {
	text-decoration-thickness: 2px;
	text-decoration-color: var(--wp--preset--color--primary);
}

/* Button Focus States */
.wp-block-button__link:focus {
	box-shadow: 0 0 0 3px rgba(31, 104, 255, 0.25);
}

/* ==========================================================================
   MOBILE OPTIMIZATION
   ========================================================================== */

/* Minimum Tap Target Size (44x44px) */
a,
button,
input,
select,
textarea,
.wp-block-button__link {
	min-height: 44px;
	min-width: 44px;
}

/* Small links in content need padding */
.entry-content a,
.wp-block-post-content a {
	padding: 2px 4px;
	margin: -2px -4px;
}

/* Navigation Links - Better Touch Targets */
.wp-block-navigation-item__content {
	padding: 12px 16px !important;
	min-height: 44px;
	display: flex;
	align-items: center;
}

/* Mobile Menu Button */
.wp-block-navigation__responsive-container-open {
	width: 48px;
	height: 48px;
	padding: 12px;
}

/* Form Elements Mobile Optimization */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="password"],
input[type="search"],
textarea,
select {
	font-size: 16px; /* Prevents zoom on iOS */
	padding: 12px 16px;
	min-height: 48px;
}

/* ==========================================================================
   RESPONSIVE IMAGES
   ========================================================================== */

/* Prevent horizontal scroll */
img,
video,
iframe,
embed,
object {
	max-width: 100%;
	height: auto;
}

/* Responsive tables */
.wp-block-table {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.wp-block-table table {
	min-width: 100%;
}

/* ==========================================================================
   COLOR CONTRAST FIXES
   ========================================================================== */

/* Ensure AA compliance (4.5:1 for normal text, 3:1 for large text) */
.has-muted-color {
	color: #4B5563 !important; /* Darker for better contrast */
}

/* Buttons need sufficient contrast */
.wp-block-button.is-style-outline .wp-block-button__link {
	border-width: 2px;
}

/* ==========================================================================
   HEADING HIERARCHY
   ========================================================================== */

/* Ensure proper heading sizes */
h1, .h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2, .h2 { font-size: clamp(1.75rem, 4vw, 2.25rem); }
h3, .h3 { font-size: clamp(1.5rem, 3vw, 1.875rem); }
h4, .h4 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h5, .h5 { font-size: clamp(1.125rem, 2vw, 1.25rem); }
h6, .h6 { font-size: clamp(1rem, 1.5vw, 1.125rem); }

/* ==========================================================================
   SCREEN READER UTILITIES
   ========================================================================== */

.screen-reader-text,
.sr-only {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background-color: var(--wp--preset--color--bg);
	border-radius: 3px;
	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
	clip: auto !important;
	clip-path: none;
	color: var(--wp--preset--color--text);
	display: block;
	font-size: 0.875rem;
	font-weight: 700;
	height: auto;
	left: 5px;
	line-height: normal;
	padding: 15px 23px 14px;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
}

/* ==========================================================================
   MOBILE SPACING
   ========================================================================== */

@media (max-width: 768px) {
	/* Reduce padding on mobile */
	.wp-block-group {
		padding-left: var(--wp--preset--spacing--20) !important;
		padding-right: var(--wp--preset--spacing--20) !important;
	}
	
	/* Stack columns on mobile */
	.wp-block-columns {
		flex-direction: column !important;
	}
	
	.wp-block-column {
		flex-basis: 100% !important;
		margin-bottom: var(--wp--preset--spacing--40);
	}
	
	/* Mobile navigation spacing */
	.wp-block-navigation__responsive-container.is-menu-open {
		padding: var(--wp--preset--spacing--40);
	}
	
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		padding-top: calc(48px + var(--wp--preset--spacing--40));
	}
	
	/* Mobile heading sizes */
	h1 { font-size: 2rem; }
	h2 { font-size: 1.75rem; }
	h3 { font-size: 1.5rem; }
	
	/* Mobile button full width */
	.wp-block-buttons {
		flex-direction: column;
		width: 100%;
	}
	
	.wp-block-button {
		width: 100%;
	}
	
	.wp-block-button__link {
		width: 100%;
		text-align: center;
	}
}

/* ==========================================================================
   CONVERSION OPTIMIZATIONS
   ========================================================================== */

/* Sticky CTA on Mobile */
@media (max-width: 768px) {
	.sticky-mobile-cta {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		background: var(--wp--preset--color--bg);
		padding: var(--wp--preset--spacing--20);
		box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
		z-index: 999;
	}
	
	/* Add bottom padding to account for sticky CTA */
	body.has-sticky-cta {
		padding-bottom: 80px;
	}
}

/* Highlight Contact Info */
.site-footer .contact-info {
	background: var(--wp--preset--color--surface);
	padding: var(--wp--preset--spacing--40);
	border-radius: 8px;
	margin-bottom: var(--wp--preset--spacing--40);
}

.site-footer .contact-info a {
	color: var(--wp--preset--color--primary);
	font-weight: 600;
	text-decoration: none;
}

.site-footer .contact-info a:hover {
	text-decoration: underline;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
	/* Hide navigation and non-essential elements */
	.site-header,
	.site-footer,
	.wp-block-navigation,
	.sticky-mobile-cta,
	.skip-link {
		display: none !important;
	}
	
	/* Ensure good contrast in print */
	* {
		color: #000 !important;
		background: #fff !important;
	}
	
	/* Show link URLs */
	a[href]:after {
		content: " (" attr(href) ")";
	}
}
