/**
 * Hero Slider Mobile Optimization (STEP 9)
 * Swiper v11 - Mobile specific adjustments
 * PC → スマートフォン ヒーロースライダー細かい調整
 * 
 * @package Higashimatudo_Shika
 */

/* ============================================
   Mobile Hero Slider Container
   ============================================ */

@media (max-width: 1200px) {
	.section-hero-slider {
		height: 500px;
	}
}

@media (max-width: 992px) {
	.section-hero-slider {
		height: 450px;
	}
}

@media (max-width: 768px) {
	.section-hero-slider {
		height: 350px;
		min-height: 300px;
	}
}

@media (max-width: 576px) {
	.section-hero-slider {
		height: 280px;
		min-height: 280px;
	}
}

@media (max-width: 480px) {
	.section-hero-slider {
		height: 240px;
		min-height: 200px;
	}
}

/* ============================================
   Swiper Slide - Mobile
   ============================================ */

@media (max-width: 768px) {
	.swiper-slide {
		width: 100%;
		height: 100%;
		flex-shrink: 0;
	}

	/* Slide content positioning */
	.hero-slide-content {
		padding: var(--spacing-xl) var(--spacing-lg);
	}

	.hero-slide-content--left {
		justify-content: flex-start;
		text-align: left;
		padding-left: calc(var(--spacing-lg) + 50px);
	}

	.hero-slide-content--center {
		justify-content: center;
		text-align: center;
	}

	.hero-slide-content--right {
		justify-content: flex-end;
		text-align: left;
		padding-right: calc(var(--spacing-lg) + 50px);
	}

	/* Content text sizing */
	.hero-slide-title {
		min-height: 2.4em;
		font-size: 1.5rem;
		line-height: 1.3;
	}

	.hero-slide-subtitle {
		font-size: 0.875rem;
		margin-bottom: var(--spacing-lg);
	}

	.hero-slide-description {
		font-size: 0.8rem;
		display: none; /* Hide on mobile */
	}
}

@media (max-width: 576px) {
	.hero-slide-content {
		padding: var(--spacing-lg) var(--spacing-md);
		justify-content: center;
		align-items: flex-end;
		padding-bottom: var(--spacing-2xl);
	}

	.hero-slide-title {
		min-height: 2.4em;
		font-size: 1.25rem;
		font-weight: 700;
		line-height: 1.2;
		margin-bottom: var(--spacing-sm);
	}

	.hero-slide-subtitle {
		font-size: 0.75rem;
		margin-bottom: var(--spacing-md);
		line-height: 1.4;
	}

	.hero-slide-description {
		display: none;
	}

	.hero-slide-text {
		width: 100%;
		min-height: 3.2rem;
	}

	.hero-slide-content--left .hero-slide-text {
		margin-left: 0;
		margin-right: auto;
	}

	.hero-slide-content--left {
		padding-left: calc(var(--spacing-md) + 42px);
	}

	.hero-slide-content--center .hero-slide-text {
		margin-left: auto;
		margin-right: auto;
	}

	.hero-slide-content--right .hero-slide-text {
		margin-left: auto;
		margin-right: 0;
	}

	.hero-slide-content--right {
		padding-right: calc(var(--spacing-md) + 42px);
	}

	.hero-slide-link {
		margin-top: var(--spacing-sm);
	}
}

/* ============================================
   Navigation Arrows - Mobile
   ============================================ */

@media (max-width: 768px) {
	.swiper-button-prev,
	.swiper-button-next {
		width: 36px;
		height: 36px;
		background-color: rgba(0, 0, 0, 0.4);
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		color: white;
		z-index: 10;
		transition: all var(--transition-fast);
		top: 50%;
		transform: translateY(-50%);
	}

	.swiper-button-prev {
		left: var(--spacing-md);
	}

	.swiper-button-next {
		right: var(--spacing-md);
	}

	.swiper-button-prev:hover,
	.swiper-button-next:hover,
	.swiper-button-prev:focus,
	.swiper-button-next:focus {
		background-color: rgba(0, 102, 204, 0.8);
	}

	.swiper-button-prev:focus,
	.swiper-button-next:focus {
		outline: 2px solid var(--color-primary);
		outline-offset: 2px;
	}

	/* Hide arrows on very small screens */
	.swiper-button-prev::after,
	.swiper-button-next::after {
		font-size: 14px;
	}
}

@media (max-width: 480px) {
	.swiper-button-prev,
	.swiper-button-next {
		width: 32px;
		height: 32px;
		opacity: 0.7;
	}

	.swiper-button-prev::after,
	.swiper-button-next::after {
		font-size: 12px;
	}
}

/* ============================================
   Pagination - Mobile
   ============================================ */

@media (max-width: 768px) {
	.swiper-pagination {
		position: absolute;
		bottom: var(--spacing-lg);
		left: 50%;
		transform: translateX(-50%);
		display: flex;
		gap: var(--spacing-sm);
		justify-content: center;
		align-items: center;
		z-index: 10;
	}

	.swiper-pagination-bullet {
		width: 10px;
		height: 10px;
		background-color: rgba(255, 255, 255, 0.6);
		border-radius: 50%;
		cursor: pointer;
		transition: all var(--transition-fast);
		border: 1px solid rgba(255, 255, 255, 0.3);
	}

	.swiper-pagination-bullet:hover {
		background-color: rgba(255, 255, 255, 0.8);
		transform: scale(1.1);
	}

	.swiper-pagination-bullet.swiper-pagination-bullet-active {
		background-color: white;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
		width: 12px;
		height: 12px;
	}

	/* Focus state */
	.swiper-pagination-bullet:focus {
		outline: 2px solid white;
		outline-offset: 2px;
	}
}

@media (max-width: 480px) {
	.swiper-pagination {
		bottom: var(--spacing-md);
	}

	.swiper-pagination-bullet {
		width: 8px;
		height: 8px;
	}

	.swiper-pagination-bullet.swiper-pagination-bullet-active {
		width: 10px;
		height: 10px;
	}
}

/* ============================================
   Touch Gestures - Mobile
   ============================================ */

@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
	/* Touch device optimization */
	.swiper {
		-webkit-user-select: none;
		user-select: none;
	}

	/* Smooth scrolling for touch */
	.swiper-wrapper {
		-webkit-overflow-scrolling: touch;
		scroll-behavior: smooth;
	}

	/* Better tap feedback */
	.swiper-button-prev,
	.swiper-button-next {
		-webkit-tap-highlight-color: transparent;
	}

	.swiper-pagination-bullet {
		-webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
	}

	/* Disable hover effects on touch */
	.swiper-button-prev:hover,
	.swiper-button-next:hover {
		background-color: rgba(0, 0, 0, 0.4);
		transform: translateY(-50%);
	}

	.swiper-pagination-bullet:hover {
		background-color: rgba(255, 255, 255, 0.6);
		transform: none;
	}
}

/* ============================================
   Slide Transition - Mobile
   ============================================ */

@media (max-width: 768px) {
	.swiper-wrapper {
		transition-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
	}

	/* Faster transition on mobile for responsiveness */
	.swiper.swiper-initialized .swiper-wrapper {
		transition-duration: 300ms;
	}

	/* Smooth fade on autoplay */
	.swiper-slide {
		opacity: 1;
		transition: opacity var(--transition-base);
	}
}

/* ============================================
   Video Background - Mobile
   ============================================ */

@media (max-width: 768px) {
	/* Pause background video on mobile to save data */
	.hero-slide-video {
		display: none;
	}

	/* Show still image instead */
	.hero-slide-image {
		display: flex;
	}
}

/* ============================================
   Accessibility - Mobile
   ============================================ */

@media (max-width: 768px) {
	/* Keyboard navigation support */
	.swiper-button-prev:focus-visible,
	.swiper-button-next:focus-visible {
		outline: 3px solid white;
		outline-offset: 3px;
	}

	/* Screen reader text */
	.sr-only {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	/* Visible skip link */
	.sr-only:focus {
		position: static;
		width: auto;
		height: auto;
		overflow: visible;
		clip: auto;
		white-space: normal;
	}

	/* Reduced motion support */
	@media (prefers-reduced-motion: reduce) {
		.swiper-wrapper {
			transition-duration: 0ms !important;
		}

		.swiper-slide,
		.swiper-pagination-bullet {
			transition: none !important;
		}
	}
}

/* ============================================
   Performance Optimization
   ============================================ */

@media (max-width: 768px) {
	/* GPU acceleration for slider */
	.swiper-wrapper {
		will-change: transform;
		transform: translate3d(0, 0, 0);
	}

	/* Lazy loading support */
	.swiper-slide img[loading="lazy"] {
		background-color: var(--color-background-light);
	}

	.swiper-slide img[loading="lazy"].loaded {
		background-image: none;
	}

	/* Reduce animations on low-end devices */
	@media (max-width: 480px) {
		.swiper-wrapper {
			transition-timing-function: linear;
		}

		.swiper-pagination-bullet {
			transition: none;
		}
	}
}

/* ============================================
   Landscape Orientation - Mobile
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
	.section-hero-slider {
		height: 250px;
		min-height: 200px;
	}

	.hero-slide-title {
		font-size: 1.25rem;
	}

	.hero-slide-subtitle {
		font-size: 0.75rem;
		display: none;
	}

	.swiper-button-prev,
	.swiper-button-next {
		width: 32px;
		height: 32px;
	}
}

/* ============================================
   Dark Mode - Mobile
   ============================================ */

@media (prefers-color-scheme: dark) {
	@media (max-width: 768px) {
		.swiper-button-prev,
		.swiper-button-next {
			background-color: rgba(255, 255, 255, 0.2);
		}

		.swiper-pagination-bullet {
			background-color: rgba(255, 255, 255, 0.5);
		}
	}
}

/* ============================================
   High DPI / Retina - Mobile
   ============================================ */

@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2), (max-width: 768px) and (min-resolution: 192dpi) {
	/* Sharper rendering */
	.swiper-slide img {
		image-rendering: -webkit-optimize-contrast;
	}

	/* Crisp button rendering */
	.swiper-button-prev,
	.swiper-button-next {
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
	}
}

/* ============================================
   iOS Safari Specific
   ============================================ */

@supports (-webkit-touch-callout: none) {
	@media (max-width: 768px) {
		/* Fix for Safari scrolling */
		.swiper {
			-webkit-overflow-scrolling: touch;
		}

		/* Better button hit area for iOS */
		.swiper-button-prev,
		.swiper-button-next {
			min-width: 44px;
			min-height: 44px;
		}

		/* Safe area for notch devices */
		@supports (padding: max(0px)) {
			.section-hero-slider {
				padding-bottom: max(0px, env(safe-area-inset-bottom));
			}
		}
	}
}

/* ============================================
   Android Chrome Specific
   ============================================ */

@media only screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
	/* Smooth scrolling for Android */
	.swiper-wrapper {
		scroll-behavior: smooth;
	}

	/* Better rendering */
	.section-hero-slider {
		-webkit-font-smoothing: antialiased;
		-webkit-backface-visibility: hidden;
	}
}

/* Match the mobile frame to the 16:5 hero image ratio. */
@media (max-width: 768px) {
	.section-hero-slider {
		height: auto;
		min-height: 0;
		aspect-ratio: 16 / 5;
	}

	.hero-slide-image img {
		object-fit: contain;
		object-position: center;
		background: transparent;
	}
}
