/**
 * SDA Bundle — Accessibility Widget base styles.
 *
 * The widget root (#heb-widget) sets --sda-a11y-primary from config via JS.
 * Per-feature dynamic CSS (font scaling, contrast filters, etc.) is generated
 * at runtime in accessibility.js and is NOT part of this file.
 */

#heb-widget {
	font-family: system-ui, -apple-system, sans-serif;
}

.heb-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 12px 8px;
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
	transition: all 0.2s;
	font-size: 13px;
	font-weight: 600;
	color: #333;
	text-align: center;
	width: 100%;
	min-height: 75px;
}

.heb-btn:hover {
	border-color: var(--sda-a11y-primary, #9a7338);
	background: #f6f0e8;
	transform: translateY(-2px);
}

.heb-btn.active {
	background: var(--sda-a11y-primary, #9a7338);
	color: #fff;
	border-color: var(--sda-a11y-primary, #9a7338);
}

.heb-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin-bottom: 4px;
	font-size: 20px;
	line-height: 1;
}

.heb-tab-btn {
	padding: 10px 20px;
	border: none;
	background: #f0f0f0;
	color: #666;
	cursor: pointer;
	font-weight: bold;
	border-radius: 6px;
	flex: 1;
	font-size: 14px;
	transition: all 0.2s;
}

.heb-tab-btn.active {
	background: var(--sda-a11y-primary, #9a7338);
	color: #fff;
}

#heb-mask-top,
#heb-mask-bottom {
	position: fixed;
	left: 0;
	right: 0;
	background: rgba(0, 0, 0, 0.85);
	z-index: 999998;
	pointer-events: none;
	display: none;
}

#heb-mask-top {
	top: 0;
}

#heb-mask-bottom {
	bottom: 0;
}

/* Widget trigger button */
#heb-trigger {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 0 !important;
	line-height: 1 !important;
	overflow: hidden !important;
}

#heb-trigger svg {
	display: block !important;
	width: 32px !important;
	height: 32px !important;
}

/* Disclaimer box */
.heb-disclaimer {
	background: #fffbeb;
	border: 1px solid #f59e0b;
	border-radius: 8px;
	padding: 12px;
	margin: 15px 0;
	font-size: 12px;
	line-height: 1.6;
	color: #92400e;
	display: flex;
	gap: 8px;
	align-items: flex-start;
}

/* Open/closed state. The JS toggles .heb-open on the panel and backdrop;
   geometry stays inline. Desktop: a short fade/rise. Mobile (below): the
   panel becomes a bottom sheet and slides up. */
#heb-panel {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY(8px);
	transition: opacity 0.16s cubic-bezier(0.22, 1, 0.36, 1), transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.16s;
}

#heb-panel.heb-open {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
	transform: none;
}

/* Scrim behind the mobile sheet; inert on desktop (display: none). */
#heb-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 999998;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s ease-out, visibility 0.2s;
}

#heb-backdrop.heb-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
	#heb-panel,
	#heb-backdrop {
		transition: none;
	}
}

/* Mobile: full-bleed bottom sheet with a grab-handle cue and a scrim; the
   trigger docks to the bottom corner (on its configured side) as a 48px
   touch target, and the cookie recall button yields while the sheet is up.
   These override the desktop geometry the JS sets inline. */
@media (max-width: 768px) {
	#heb-backdrop {
		display: block;
	}

	#heb-panel {
		width: auto !important;
		left: 0 !important;
		right: 0 !important;
		top: auto !important;
		bottom: 0 !important;
		height: auto !important;
		max-height: 85vh !important;
		max-height: 85dvh !important;
		border-radius: 14px 14px 0 0 !important;
		padding-bottom: env(safe-area-inset-bottom);
		transform: translateY(100%);
		transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.22s;
	}

	#heb-panel.heb-open {
		transform: none;
	}

	#heb-panel::before {
		content: "";
		position: absolute;
		top: 6px;
		left: 50%;
		transform: translateX(-50%);
		width: 36px;
		height: 4px;
		border-radius: 2px;
		background: rgba(255, 255, 255, 0.4);
		z-index: 1;
	}

	@media (prefers-reduced-motion: reduce) {
		#heb-panel {
			transition: none;
		}
	}

	body.sda-a11y-open #sda-cc-recall {
		display: none;
	}

	#heb-trigger {
		width: 48px !important;
		height: 48px !important;
		top: auto !important;
		bottom: 16px !important;
	}

	#heb-trigger[data-side="right"] {
		right: 0 !important;
		left: auto !important;
	}

	#heb-trigger[data-side="left"] {
		left: 0 !important;
		right: auto !important;
	}

	#heb-trigger svg {
		width: 24px !important;
		height: 24px !important;
	}

	/* Density: tighter chrome and cards so the sheet needs less scrolling.
	   Touch targets stay at or above 44px. */
	.heb-header {
		padding: 12px 14px !important;
	}

	.heb-header h2 {
		font-size: 16px !important;
	}

	.heb-content {
		padding: 10px !important;
	}

	.heb-card {
		padding: 10px !important;
		margin-bottom: 10px !important;
	}

	.heb-tabs {
		margin-bottom: 10px !important;
	}

	.heb-tab-btn {
		padding: 8px 16px;
	}

	.heb-btn {
		min-height: 56px;
		font-size: 12px;
		padding: 6px 4px;
	}

	.heb-icon {
		width: 24px;
		height: 24px;
		font-size: 18px;
		margin-bottom: 2px;
	}

	.heb-disclaimer {
		font-size: 11px;
		padding: 10px;
	}
}

/* ---------------------------------------------------------------------------
 * Overlay contract
 *
 * A page that opens a full-screen overlay of its own (a gallery lightbox, a
 * video player) sets `sda-overlay-open` on <body>. The widget is fixed at
 * z-index 999999, so without this it lands on top of the overlay's controls.
 * It steps aside for as long as the class is present and comes straight back.
 * ------------------------------------------------------------------------- */
body.sda-overlay-open #heb-trigger {
	opacity: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
	transition: opacity 0.2s ease, visibility 0.2s ease !important;
}

/* An open panel is a deliberate user action, so it stays put: an overlay
 * appearing underneath must not swallow controls someone is actively using. */
body.sda-overlay-open #heb-panel.heb-open {
	opacity: 1 !important;
	visibility: visible !important;
}
