/**
 * Sábado Control — Frontend Banner Styles (v3.0)
 * Refatorado: responsividade total, mobile-first, sem larguras fixas
 *
 * @package ShabbatControl
 */

/* ── CSS Custom Properties ──────────────────────────────────── */
.sc-banner {
	--sc-accent: #f5c842;
	--sc-text-primary: #ffffff;
	--sc-text-muted: rgba(255, 255, 255, 0.75);
	--sc-bg-dark: linear-gradient(155deg, #0e0e2e, #1a1a4a);
	--sc-radius: 8px;
	--sc-transition: 0.18s ease;
}

/* ── Reset ───────────────────────────────────────────────────── */
.sc-banner *,
.sc-banner *::before,
.sc-banner *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* ── Bloqueio quando Sábado ativo ───────────────────────────── */
html.sc-shabbat-active,
body.sc-shabbat-active {
	overflow: hidden !important;
	height: 100% !important;
	max-height: 100% !important;
}

body.sc-shabbat-active > *:not(.sc-banner):not(#wpadminbar):not(.sc-modal) {
	visibility: hidden !important;
	pointer-events: none !important;
	opacity: 0 !important;
}

body.sc-shabbat-active #page,
body.sc-shabbat-active #wrapper,
body.sc-shabbat-active #outer-wrapper,
body.sc-shabbat-active #site-container,
body.sc-shabbat-active .site,
body.sc-shabbat-active #main-container,
body.sc-shabbat-active .site-wrapper {
	visibility: hidden !important;
	pointer-events: none !important;
	opacity: 0 !important;
}

/* ── Wrapper externo — fullscreen overlay ───────────────────── */
.sc-banner {
	position: fixed !important;
	inset: 0 !important;
	width: 100% !important;
	/* Altura da área VISÍVEL do navegador.
	   100vh em mobile inclui a área atrás da barra de URL e cortava
	   o rodapé do hero (countdown após a tagline). Ordem de fallback:
	   1) var --sc-vh definida pelo JS (innerHeight real)
	   2) 100vh (navegadores antigos sem JS)
	   3) 100dvh via @supports (padrão moderno, ver abaixo) */
	height: 100vh !important;
	height: calc(var(--sc-vh, 1vh) * 100) !important;
	z-index: 2147483647 !important;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	overflow-y: auto;
	overflow-x: hidden;
	line-height: 1.5;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: var(--sc-accent) rgba(255,255,255,0.1);
}

@supports (height: 100dvh) {
	.sc-banner { height: 100dvh !important; }
}

/* ════════════════════════════════════════════════════════════════
   HERO — mobile-first, sem padding/largura fixa
   ════════════════════════════════════════════════════════════════ */
.sc-banner__hero {
	position: relative;
	/* Mesma lógica de viewport visível do .sc-banner: o conteúdo é
	   ancorado embaixo (flex-end), então a altura precisa ser a da
	   área realmente visível — senão a tagline/countdown ficam atrás
	   da barra do navegador no celular. */
	min-height: 100vh;
	min-height: calc(var(--sc-vh, 1vh) * 100);
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	/* Mobile: padding menor */
	padding: clamp(20px, 5vw, 44px) clamp(16px, 5vw, 44px) clamp(32px, 6vw, 52px);
	overflow: hidden;
	background: var(--sc-bg-dark);
}

@supports (min-height: 100dvh) {
	.sc-banner__hero { min-height: 100dvh; }
}

/* Telas estreitas: reserva espaço para o logo (posicionado em
   absolute no topo) para o conteúdo nunca colidir com ele quando
   o texto for longo, e garante que a rolagem interna funcione. */
@media (max-width: 600px) {
	.sc-banner__hero {
		padding-top: 88px;
	}
}

/* Imagem de fundo */
.sc-banner__hero-bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
}

/* Overlay gradiente */
.sc-banner__hero-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		155deg,
		rgba(12, 12, 30, 0.65) 0%,
		rgba(12, 12, 30, 0.20) 42%,
		rgba(8, 8, 22, 0.85) 100%
	);
}

/* Estrelas */
.sc-banner__stars {
	position: absolute;
	top: 0; left: 0; right: 0;
	height: 55%;
	pointer-events: none;
}

.sc-banner__star {
	position: absolute;
	background: #ffffff;
	border-radius: 50%;
	animation: sc-twinkle 3s infinite alternate;
}

@keyframes sc-twinkle {
	from { opacity: 0.25; transform: scale(1); }
	to   { opacity: 1;    transform: scale(1.5); }
}

/* Linha de destaque */
.sc-banner__hero-rule {
	position: absolute;
	bottom: 0; left: 0; right: 0;
	height: 4px;
	background: linear-gradient(90deg, transparent, var(--sc-accent), transparent);
}

/* ── Logo ──────────────────────────────────────────────────── */
.sc-banner__logo {
	position: absolute;
	top: clamp(14px, 3vw, 24px);
	left: clamp(14px, 3vw, 28px);
	display: flex;
	align-items: center;
	gap: 8px;
	z-index: 10;
	max-width: calc(100% - 28px); /* não transborda */
}

.sc-banner__logo-icon {
	width: clamp(30px, 5vw, 36px);
	height: clamp(30px, 5vw, 36px);
	background: var(--sc-accent);
	border-radius: var(--sc-radius);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(16px, 3vw, 19px);
	line-height: 1;
	flex-shrink: 0;
}

.sc-banner__logo-img {
	height: clamp(28px, 4vw, 36px);
	width: auto;
	max-width: min(140px, 35vw); /* respeita tela pequena */
	object-fit: contain;
	border-radius: 6px;
	flex-shrink: 0;
}

.sc-banner__logo-text {
	font-size: clamp(13px, 2.5vw, 17px);
	font-weight: 700;
	color: #ffffff;
	letter-spacing: 0.2px;
	/* Trunca se muito longo */
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: min(200px, 40vw);
}

/* ── Conteúdo hero ──────────────────────────────────────────── */
.sc-banner__hero-content {
	position: relative;
	z-index: 10;
	width: 100%;
}

/* Títulos: fluid type via clamp — sem quebrar em 320px */
.sc-banner__title {
	font-size: clamp(28px, 7vw, 52px);
	font-weight: 900;
	color: var(--sc-text-primary);
	line-height: 1.05;
	margin-bottom: clamp(12px, 2vw, 16px);
	text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
	letter-spacing: -0.5px;
	/* Impede overflow de texto longo */
	overflow-wrap: break-word;
	word-break: break-word;
}

.sc-banner__verse {
	font-size: clamp(13px, 2.5vw, 16px);
	font-style: italic;
	color: var(--sc-text-muted);
	line-height: 1.65;
	margin-bottom: clamp(18px, 3vw, 28px);
	font-weight: 300;
	max-width: min(380px, 100%); /* não ultrapassa a tela */
}

.sc-banner__verse cite {
	font-style: normal;
	font-weight: 700;
	color: var(--sc-accent);
	display: block;
	margin-top: 6px;
	font-size: clamp(11px, 2vw, 13px);
	letter-spacing: 0.6px;
}

.sc-banner__subtitle {
	font-size: clamp(20px, 5vw, 40px);
	font-weight: 700;
	color: var(--sc-text-primary);
	line-height: 1.15;
	text-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
	margin-bottom: clamp(8px, 1.5vw, 12px);
	overflow-wrap: break-word;
	word-break: break-word;
}

.sc-banner__tagline {
	font-size: clamp(14px, 2.5vw, 18px);
	color: var(--sc-text-muted);
	font-weight: 300;
	letter-spacing: 0.3px;
}

/* ── Countdown ──────────────────────────────────────────────── */
.sc-countdown {
	margin-top: clamp(14px, 2.5vw, 20px);
	display: inline-block;
}

.sc-countdown__label {
	display: block;
	font-size: clamp(9px, 1.8vw, 11px);
	text-transform: uppercase;
	letter-spacing: 1px;
	color: rgba(255,255,255,0.65);
	margin-bottom: 5px;
	font-weight: 600;
}

.sc-countdown__timer {
	font-size: clamp(20px, 5vw, 28px);
	font-weight: 800;
	color: var(--sc-accent);
	letter-spacing: 1px;
	font-variant-numeric: tabular-nums;
}

.sc-countdown__timer em {
	font-style: normal;
	font-size: clamp(10px, 1.8vw, 13px);
	font-weight: 400;
	color: rgba(255,255,255,0.55);
	margin-right: 6px;
}

/* ── Detecção de localização (novo) ─────────────────────────── */
.sc-location-status {
	position: absolute;
	top: clamp(14px, 3vw, 22px);
	right: clamp(14px, 3vw, 22px);
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 6px;
	background: rgba(0,0,0,0.35);
	border: 1px solid rgba(255,255,255,0.15);
	border-radius: 20px;
	padding: 5px clamp(8px, 2vw, 12px);
	font-size: clamp(9px, 1.8vw, 11px);
	color: rgba(255,255,255,0.75);
	backdrop-filter: blur(6px);
	transition: opacity var(--sc-transition);
	max-width: min(200px, 40vw);
}

.sc-location-status__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--sc-accent);
	flex-shrink: 0;
	animation: sc-pulse 2s infinite;
}

.sc-location-status__dot--fallback {
	background: rgba(255,255,255,0.5);
	animation: none;
}

.sc-location-status__dot--error {
	background: #ff6b6b;
	animation: none;
}

@keyframes sc-pulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50%       { opacity: 0.5; transform: scale(0.85); }
}

.sc-location-status__text {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ════════════════════════════════════════════════════════════════
   CATÁLOGO — responsivo, sem larguras fixas
   ════════════════════════════════════════════════════════════════ */
.sc-banner__catalog {
	background: #f7f4ee;
	padding: clamp(18px, 4vw, 28px) clamp(14px, 4vw, 28px) clamp(24px, 5vw, 36px);
}

.sc-banner__catalog-divider {
	height: 3px;
	background: linear-gradient(90deg, var(--sc-accent), transparent);
	border-radius: 2px;
	margin-bottom: clamp(14px, 2vw, 18px);
}

.sc-banner__catalog-title {
	font-size: clamp(16px, 4vw, 22px);
	font-weight: 800;
	color: #1a1a2e;
	line-height: 1.2;
}

.sc-banner__catalog-subtitle {
	font-size: clamp(11px, 2vw, 13px);
	color: #666;
	margin-top: 4px;
	margin-bottom: clamp(14px, 3vw, 20px);
}

/* Grid de livros — responsivo com auto-fill */
.sc-banner__books {
	display: grid;
	/* Mobile (320px): cabe 3 colunas com ~90px mínimo */
	grid-template-columns: repeat(auto-fill, minmax(clamp(70px, 18vw, 100px), 1fr));
	gap: clamp(8px, 2vw, 12px);
}

.sc-banner__book {
	display: flex;
	flex-direction: column;
	gap: 5px;
	align-items: center;
	cursor: pointer;
	transition: transform var(--sc-transition);
	/* Previne overflow em telas pequenas */
	min-width: 0;
}

.sc-banner__book:hover,
.sc-banner__book:focus-visible {
	transform: translateY(-3px);
	outline: 2px solid var(--sc-accent);
	border-radius: 6px;
}

.sc-banner__book-cover {
	width: 100%;
	aspect-ratio: 2 / 3;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
	position: relative;
}

.sc-banner__book-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.sc-banner__book-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 6px;
	color: rgba(255,255,255,0.8);
	font-size: clamp(8px, 1.5vw, 10px);
	text-align: center;
	line-height: 1.3;
}

.sc-banner__book-placeholder .sc-book-emoji {
	font-size: clamp(16px, 4vw, 22px);
}

/* Cores dos placeholders */
.sc-banner__book:nth-child(1) .sc-banner__book-cover { background: linear-gradient(145deg,#1a2a4a,#0d1b35); }
.sc-banner__book:nth-child(2) .sc-banner__book-cover { background: linear-gradient(145deg,#c8a800,#a07e00); }
.sc-banner__book:nth-child(3) .sc-banner__book-cover { background: linear-gradient(145deg,#1a1a3e,#0a0a2a); }
.sc-banner__book:nth-child(4) .sc-banner__book-cover { background: linear-gradient(145deg,#7a1515,#4a0a0a); }
.sc-banner__book:nth-child(5) .sc-banner__book-cover { background: linear-gradient(145deg,#0d3d2a,#062218); }
.sc-banner__book:nth-child(6) .sc-banner__book-cover { background: linear-gradient(145deg,#2a0d3d,#160623); }
.sc-banner__book:nth-child(7) .sc-banner__book-cover { background: linear-gradient(145deg,#3a2a1a,#261a0d); }
.sc-banner__book:nth-child(8) .sc-banner__book-cover { background: linear-gradient(145deg,#1a3a3a,#0d2626); }

.sc-banner__book-name {
	font-size: clamp(8px, 1.8vw, 10px);
	color: #444;
	text-align: center;
	line-height: 1.3;
	font-weight: 600;
	/* Limita a 2 linhas */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	width: 100%;
}

.sc-banner__book-author {
	font-size: clamp(7px, 1.5vw, 9px);
	color: #888;
	text-align: center;
	line-height: 1.2;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
	width: 100%;
}

/* ════════════════════════════════════════════════════════════════
   MODAL — responsivo, sem max-width fixa
   ════════════════════════════════════════════════════════════════ */
.sc-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483647;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(12px, 3vw, 20px);
}

.sc-modal[hidden] { display: none !important; }

.sc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.72);
	backdrop-filter: blur(4px);
}

.sc-modal__box {
	position: relative;
	background: #fff;
	border-radius: 14px;
	/* Responsivo: até 480px mas nunca maior que viewport - padding */
	max-width: min(480px, calc(100vw - 24px));
	width: 100%;
	max-height: min(85vh, calc(100dvh - 40px));
	overflow-y: auto;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
	animation: sc-modal-in 0.22s ease;
}

@keyframes sc-modal-in {
	from { opacity: 0; transform: scale(0.92) translateY(12px); }
	to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.sc-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	background: rgba(0,0,0,0.06);
	border: none;
	border-radius: 50%;
	width: clamp(28px, 6vw, 32px);
	height: clamp(28px, 6vw, 32px);
	font-size: 14px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	color: #333;
	transition: background var(--sc-transition);
	/* Touch target mínimo */
	min-width: 44px;
	min-height: 44px;
}

.sc-modal__close:hover { background: rgba(0,0,0,0.14); }

.sc-modal__inner {
	display: flex;
	flex-direction: row; /* default desktop */
	gap: clamp(14px, 3vw, 20px);
	padding: clamp(16px, 4vw, 24px);
	align-items: flex-start;
}

/* Mobile: empilha verticalmente */
@media (max-width: 480px) {
	.sc-modal__inner {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}
}

.sc-modal__cover {
	width: clamp(80px, 20vw, 110px);
	min-width: clamp(80px, 20vw, 110px);
	aspect-ratio: 2 / 3;
	object-fit: cover;
	border-radius: 8px;
	box-shadow: 0 6px 20px rgba(0,0,0,0.25);
	flex-shrink: 0;
}

.sc-modal__cover-placeholder {
	width: clamp(80px, 20vw, 110px);
	min-width: clamp(80px, 20vw, 110px);
	aspect-ratio: 2 / 3;
	background: linear-gradient(145deg,#1a2a4a,#0d1b35);
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: clamp(24px, 6vw, 36px);
	flex-shrink: 0;
}

.sc-modal__info {
	flex: 1;
	padding-top: 4px;
	min-width: 0; /* permite encolher */
}

.sc-modal__title {
	font-size: clamp(14px, 3.5vw, 18px);
	font-weight: 800;
	color: #1a1a2e;
	line-height: 1.25;
	margin-bottom: 6px;
	overflow-wrap: break-word;
}

.sc-modal__author {
	font-size: clamp(11px, 2.5vw, 13px);
	color: var(--sc-accent, #f5c842);
	font-weight: 600;
	margin-bottom: 10px;
	filter: brightness(0.75);
}

.sc-modal__desc {
	font-size: clamp(12px, 2.5vw, 14px);
	color: #555;
	line-height: 1.65;
}

/* ── Ocultação de preços/botões WooCommerce ─────────────────── */
body.sc-shabbat-active .woocommerce-Price-amount,
body.sc-shabbat-active .woocommerce-Price-currencySymbol,
body.sc-shabbat-active .woocommerce-variation-price,
body.sc-shabbat-active .price .amount,
body.sc-shabbat-active .price ins,
body.sc-shabbat-active .price del,
body.sc-shabbat-active .summary .price,
body.sc-shabbat-active .product .price,
body.sc-shabbat-active .products .price,
body.sc-shabbat-active p.price,
body.sc-shabbat-active span.price,
body.sc-shabbat-active .jet-woo-product-price,
body.sc-shabbat-active .jet-woo-builder-price,
body.sc-shabbat-active .elementor-widget-woocommerce-product-price { display: none !important; }

body.sc-shabbat-active .woocommerce .add_to_cart_button,
body.sc-shabbat-active .woocommerce .single_add_to_cart_button,
body.sc-shabbat-active .woocommerce button[name="add-to-cart"],
body.sc-shabbat-active .woocommerce .ajax_add_to_cart,
body.sc-shabbat-active .woocommerce form.cart,
body.sc-shabbat-active .woocommerce .quantity,
body.sc-shabbat-active .woocommerce .variations_form,
body.sc-shabbat-active .products .add_to_cart_button,
body.sc-shabbat-active .jet-woo-product-add-to-cart { display: none !important; }

/* ── Acessibilidade / Print ─────────────────────────────────── */
@media print { .sc-banner { display: none !important; } }
@media (prefers-contrast: high) { .sc-banner__hero-overlay { background: rgba(0,0,0,0.75); } }
@media (prefers-reduced-motion: reduce) {
	.sc-banner__star  { animation: none; opacity: 0.5; }
	.sc-modal__box    { animation: none; }
	.sc-banner__book  { transition: none; }
	.sc-location-status__dot { animation: none; }
}

/* ── Safe area (notch, home bar) ────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
	.sc-banner__hero {
		padding-bottom: calc(clamp(32px, 6vw, 52px) + env(safe-area-inset-bottom));
	}
	.sc-banner__catalog {
		padding-bottom: calc(clamp(24px, 5vw, 36px) + env(safe-area-inset-bottom));
	}
}
