/* =================================================================
 * home-adaptive.css — emergency-hero банер + модал «Як діяти»
 * Скоуп: .ha-* префікс. Жодних глобальних змін.
 * Підключається лише на front-page-adaptive.php (див. inc/enqueue.php).
 * ================================================================= */

:root {
	--ha-red:        #e5322a;
	--ha-red-deep:   #b3261e;
	--ha-red-glow:   rgba(229, 50, 42, 0.32);
	--ha-paper:      #fff;
	--ha-ink:        #0e0e0f;
	--ha-tg:         #2aabee;
	--ha-tg-deep:    #1e8fcb;
	--ha-on-red-08:  rgba(255, 255, 255, 0.08);
	--ha-on-red-10:  rgba(255, 255, 255, 0.10);
	--ha-on-red-14:  rgba(255, 255, 255, 0.14);
	--ha-on-red-18:  rgba(255, 255, 255, 0.18);
	--ha-on-red-22:  rgba(255, 255, 255, 0.22);
	--ha-on-red-78:  rgba(255, 255, 255, 0.78);
	--ha-on-red-86:  rgba(255, 255, 255, 0.86);
}

/* надійний toggle для banner / modal / tile / tile-night */
.ha-alarm[hidden],
.ha-modal[hidden],
.ha-alarm [hidden] {
	display: none !important;
}

/* ============================== BANNER ============================= */

.ha-alarm {
	padding: 16px 0;
	font-family: 'Manrope', system-ui, -apple-system, sans-serif;
}

.ha-alarm-card {
	position: relative;
	overflow: hidden;
	background: linear-gradient(135deg, var(--ha-red) 0%, var(--ha-red-deep) 100%);
	color: var(--ha-paper);
	border-radius: 22px;
	padding: 28px 28px 24px;
	box-shadow: 0 16px 44px var(--ha-red-glow);
}

/* radial halo decoration (мокап .status-now::before) */
.ha-alarm-deco {
	position: absolute;
	right: -90px;
	bottom: -90px;
	width: 280px;
	height: 280px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.10);
	pointer-events: none;
	z-index: 0;
}
.ha-alarm-deco::after {
	content: '';
	position: absolute;
	inset: 60px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.06);
}

.ha-alarm-card > *:not(.ha-alarm-deco):not(.ha-alarm-close) {
	position: relative;
	z-index: 1;
}

/* close (✕) — згорнути банер на цю сесію */
.ha-alarm-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border: 1px solid var(--ha-on-red-18);
	background: var(--ha-on-red-10);
	color: #fff;
	border-radius: 50%;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.ha-alarm-close:hover,
.ha-alarm-close:focus-visible {
	background: var(--ha-on-red-22);
	border-color: var(--ha-on-red-22);
	transform: rotate(90deg);
}
.ha-alarm-close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* top label-pill */
.ha-alarm-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--ha-on-red-14);
	border: 1px solid var(--ha-on-red-18);
	padding: 7px 14px 7px 12px;
	border-radius: 999px;
	font-family: 'Unbounded', 'Manrope', sans-serif;
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	margin-bottom: 14px;
	color: var(--ha-on-red-86);
}

.ha-alarm-label > span {
	white-space: nowrap;
}

.ha-alarm-sep {
	opacity: 0.55;
	font-weight: 600;
}

.ha-alarm-pulse {
	flex: 0 0 auto;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55);
	animation: ha-pulse 1.4s infinite;
}

@keyframes ha-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
	50%      { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.ha-alarm-pulse { animation: none; }
}

/* title + lead */
.ha-alarm-title {
	margin: 0 0 10px;
	font-family: 'Unbounded', 'Manrope', sans-serif;
	font-weight: 800;
	font-size: clamp(26px, 4vw, 44px);
	line-height: 1.02;
	letter-spacing: -0.02em;
	color: #fff;
}

.ha-alarm-lead {
	margin: 0 0 22px;
	font-size: clamp(14.5px, 1vw + 9px, 16.5px);
	line-height: 1.5;
	color: var(--ha-on-red-86);
	max-width: 60ch;
}

/* ============================== TILES GRID ========================= */

.ha-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin-bottom: 22px;
}

@media (max-width: 900px) {
	.ha-grid { grid-template-columns: repeat(2, 1fr); }
}

.ha-tile {
	background: var(--ha-on-red-10);
	border: 1px solid var(--ha-on-red-18);
	border-radius: 14px;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: #fff;
	text-decoration: none;
	transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
	min-height: 96px;
}

.ha-tile:hover,
.ha-tile:focus-visible {
	background: var(--ha-on-red-18);
	border-color: var(--ha-on-red-22);
	transform: translateY(-2px);
	color: #fff;
}

.ha-tile:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.ha-tile-head {
	display: flex;
	align-items: center;
	gap: 7px;
	font-family: 'Manrope', sans-serif;
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--ha-on-red-78);
	margin-bottom: 2px;
}

.ha-tile-head svg {
	flex: 0 0 14px;
}

.ha-tile-val {
	font-family: 'Unbounded', 'Manrope', sans-serif;
	font-weight: 800;
	font-size: 22px;
	line-height: 1.05;
	letter-spacing: -0.01em;
}

.ha-tile-sub {
	font-size: 12.5px;
	color: var(--ha-on-red-78);
	line-height: 1.3;
}

.ha-tile--bad .ha-tile-val { color: #ffe068; }
.ha-tile--ok  .ha-tile-val { color: #b6f0a5; }

/* ============================== ACTIONS ============================ */

.ha-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.ha-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 18px;
	border-radius: 11px;
	font-family: 'Manrope', sans-serif;
	font-weight: 700;
	font-size: 14px;
	line-height: 1.2;
	text-decoration: none;
	border: 1px solid transparent;
	cursor: pointer;
	transition: background 140ms ease, color 140ms ease, transform 140ms ease, border-color 140ms ease;
	white-space: nowrap;
}

.ha-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Telegram CTA — primary-tier акцент: брендовий синій з glow */
.ha-btn--tg {
	background: var(--ha-tg);
	color: #fff;
	font-weight: 800;
	padding: 12px 20px;
	box-shadow: 0 6px 18px rgba(42, 171, 238, 0.40);
	border-color: var(--ha-tg);
}
.ha-btn--tg:hover,
.ha-btn--tg:focus-visible {
	background: var(--ha-tg-deep);
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 8px 22px rgba(42, 171, 238, 0.55);
}

.ha-btn--light {
	background: #fff;
	color: var(--ha-red-deep);
	font-weight: 700;
}
.ha-btn--light:hover,
.ha-btn--light:focus-visible {
	background: #fff;
	color: var(--ha-red-deep);
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.ha-btn--ghost {
	background: var(--ha-on-red-10);
	color: #fff;
	border-color: var(--ha-on-red-22);
}
.ha-btn--ghost:hover,
.ha-btn--ghost:focus-visible {
	background: var(--ha-on-red-22);
	color: #fff;
	transform: translateY(-1px);
}

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

@media (max-width: 720px) {
	.ha-alarm { padding: 10px 0; }
	.ha-alarm-card { padding: 18px 16px 16px; border-radius: 16px; }
	.ha-alarm-deco { width: 180px; height: 180px; right: -90px; bottom: -90px; }
	.ha-alarm-title { font-size: clamp(22px, 6vw, 28px); margin-bottom: 6px; }
	.ha-alarm-lead { margin-bottom: 14px; font-size: 14px; }
	.ha-alarm-label { padding: 5px 10px; font-size: 10.5px; margin-bottom: 10px; }
	.ha-alarm-close { top: 8px; right: 8px; width: 28px; height: 28px; }
	.ha-grid { gap: 8px; margin-bottom: 14px; }
	.ha-tile { min-height: 0; padding: 10px 12px; gap: 2px; }
	.ha-tile-head { font-size: 10px; letter-spacing: 0.06em; }
	.ha-tile-val { font-size: 17px; }
	.ha-tile-sub { font-size: 11.5px; line-height: 1.25; }
	.ha-actions { gap: 8px; }
	.ha-btn { padding: 10px 14px; font-size: 13px; gap: 6px; }
}

@media (max-width: 480px) {
	.ha-alarm-card { padding: 16px 14px 14px; }
	.ha-alarm-title { font-size: 22px; }
	.ha-alarm-lead { font-size: 13.5px; line-height: 1.45; margin-bottom: 12px; }

	/* 2 col grid — щоб не розтягувало по висоті у column */
	.ha-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
	.ha-tile { padding: 8px 10px; }
	.ha-tile-head svg { width: 12px; height: 12px; }
	.ha-tile-val { font-size: 15px; line-height: 1.1; }
	.ha-tile-sub {
		font-size: 11px;
		/* clip до 1 рядка щоб висота лишалась передбачуваною */
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.ha-actions { gap: 6px; }
	.ha-btn { flex: 1 1 calc(50% - 3px); justify-content: center; padding: 10px 12px; font-size: 12.5px; }
	.ha-btn--tg { flex: 1 1 100%; padding: 11px 14px; }
}

/* ============================== MODAL ============================== */

.ha-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
	animation: ha-modal-fade 160ms ease;
}

@keyframes ha-modal-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.ha-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(14, 14, 15, 0.55);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	cursor: pointer;
}

.ha-modal-panel {
	position: relative;
	max-width: 520px;
	width: 100%;
	max-height: calc(100vh - 32px);
	overflow: auto;
	background: var(--ha-paper);
	color: var(--ha-ink);
	border-radius: 16px;
	padding: 28px 28px 24px;
	box-shadow: 0 20px 60px rgba(14, 14, 15, 0.32);
	font-family: 'Manrope', system-ui, sans-serif;
	animation: ha-modal-pop 200ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes ha-modal-pop {
	from { transform: translateY(12px) scale(0.96); opacity: 0; }
	to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.ha-modal-title {
	margin: 0 0 16px;
	font-family: 'Unbounded', 'Manrope', sans-serif;
	font-weight: 700;
	font-size: 20px;
	line-height: 1.2;
	letter-spacing: -0.01em;
	padding-right: 36px;
}

.ha-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border: none;
	background: rgba(14, 14, 15, 0.06);
	color: var(--ha-ink);
	border-radius: 50%;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 120ms ease;
}

.ha-modal-close:hover,
.ha-modal-close:focus-visible {
	background: rgba(14, 14, 15, 0.12);
}
.ha-modal-close:focus-visible {
	outline: 2px solid var(--ha-red);
	outline-offset: 2px;
}

.ha-modal-list {
	margin: 0;
	padding-left: 1.2em;
	display: flex;
	flex-direction: column;
	gap: 10px;
	font-size: 14.5px;
	line-height: 1.55;
}

.ha-modal-list li b {
	font-weight: 700;
}

@media (max-width: 480px) {
	.ha-modal { padding: 0; align-items: flex-end; }
	.ha-modal-panel {
		max-height: 92vh;
		border-radius: 16px 16px 0 0;
		padding: 24px 20px 20px;
		animation-name: ha-modal-sheet;
	}
	.ha-modal-title { font-size: 18px; }
	@keyframes ha-modal-sheet {
		from { transform: translateY(24px); opacity: 0; }
		to   { transform: translateY(0);    opacity: 1; }
	}
}

/* lock-scroll, ставимо клас на body коли modal open */
.ha-scroll-lock { overflow: hidden; }
