/**
 * Capsa (Explore the Mira Ecosystem) — page widget styles.
 *
 * Ported from src/pages/Capsa.tsx and its section component
 * HospitalFloorPlan.tsx (interactive hospital cutaway with zone hotspots
 * and a detail panel).
 *
 * All selectors are `ig-`-prefixed. Brand tokens are declared on the page
 * wrapper classes (mirroring assets/css/widgets.css) so they inherit into
 * any reused base classes. :root is intentionally NOT touched.
 */

/* =========================================================================
   Brand tokens (scoped to this page's wrappers — never :root)
   ========================================================================= */
.ig-capsa-hero,
.ig-capsa-floorplan,
.ig-capsa-cta {
	--ig-navy: hsl(225 70% 17%);
	--ig-navy-light: hsl(225 50% 30%);
	--ig-gold: hsl(38 91% 55%);
	--ig-gold-light: hsl(38 91% 70%);
	--ig-teal: hsl(174 60% 42%);
	--ig-teal-light: hsl(174 50% 60%);
	--ig-secondary: hsl(38 91% 55%);
	--ig-secondary-foreground: hsl(225 70% 17%);
	--ig-background: var(--ig-surface, hsl(0 0% 100%));
	--ig-foreground: var(--ig-ink, hsl(225 70% 17%));
	--ig-muted: hsl(220 20% 96%);
	--ig-muted-foreground: hsl(220 10% 46%);
	--ig-border: hsl(220 20% 90%);
	--ig-card: hsl(0 0% 100%);
	--ig-radius: 0.75rem;

	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	box-sizing: border-box;
}

.ig-capsa-hero *,
.ig-capsa-floorplan *,
.ig-capsa-cta * {
	box-sizing: border-box;
}

/* Container — matches Tailwind's centered container (max 1400px, 2rem pad). */
.ig-capsa-container {
	width: 100%;
	max-width: 1400px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 2rem;
	padding-right: 2rem;
}

.ig-capsa-container-sm {
	width: 100%;
	max-width: 48rem; /* max-w-3xl-ish centered CTA */
	margin-left: auto;
	margin-right: auto;
	padding-left: 2rem;
	padding-right: 2rem;
}

/* Shared eyebrow label (SectionLabel.tsx). */
.ig-capsa-eyebrow {
	display: inline-block;
	font-size: 0.875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--ig-gold);
}

/* =========================================================================
   Hero — centered text over navy with gold + teal ribbon accents.
   (Capsa.tsx: .ribbon-section min-h-[40vh])
   ========================================================================= */
.ig-capsa-hero {
	position: relative;
	overflow: hidden;
	background: var(--ig-surface, var(--ig-navy));
	min-height: 40vh;
	display: flex;
	align-items: center;
}

/* Gold angular block — bottom left (index.css .ribbon-section::before). */
.ig-capsa-hero__ribbon {
	position: absolute;
	z-index: 1;
	pointer-events: none;
}

.ig-capsa-hero__ribbon--gold {
	left: -60px;
	bottom: -40px;
	width: 220px;
	height: 350px;
	background: var(--ig-gold);
	clip-path: polygon(0 30%, 100% 0, 100% 100%, 0 100%);
}

.ig-capsa-hero__ribbon--teal {
	right: -40px;
	top: -40px;
	width: 200px;
	height: 320px;
	background: var(--ig-teal);
	clip-path: polygon(0 0, 100% 0, 100% 100%, 0 60%);
}

.ig-capsa-hero__inner {
	position: relative;
	z-index: 10;
	padding-top: 4rem;
	padding-bottom: 4rem;
	text-align: center;
}

.ig-capsa-hero__content {
	animation: ig-capsa-fade-in-up 0.6s ease-out both;
}

.ig-capsa-hero__eyebrow {
	color: var(--ig-gold-light);
	margin-bottom: 0.75rem;
}

.ig-capsa-hero__heading {
	font-size: clamp(2.25rem, 5vw, 3.75rem);
	font-weight: 800;
	color: #fff;
	line-height: 1.1;
	margin: 0 0 1rem;
}

.ig-capsa-hero__sub {
	font-size: 1.125rem;
	color: rgba(255, 255, 255, 0.7);
	max-width: 42rem;
	margin: 0 auto;
	line-height: 1.6;
}

/* =========================================================================
   Interactive Floor Plan (HospitalFloorPlan.tsx)
   ========================================================================= */
.ig-capsa-floorplan {
	padding: 4rem 0;
	background: var(--ig-surface, var(--ig-muted));
}

@media (min-width: 1024px) {
	.ig-capsa-floorplan {
		padding: 6rem 0;
	}
}

.ig-capsa-floorplan__head {
	text-align: center;
	margin-bottom: 3rem;
}

.ig-capsa-floorplan__heading {
	font-size: clamp(1.875rem, 4vw, 2.25rem);
	font-weight: 700;
	color: var(--ig-navy);
	margin: 0.75rem 0 0.5rem;
}

.ig-capsa-floorplan__desc {
	color: var(--ig-muted-foreground);
	max-width: 36rem;
	margin: 0 auto;
	line-height: 1.6;
}

.ig-capsa-floorplan__layout {
	display: grid;
	gap: 2rem;
	align-items: start;
}

@media (min-width: 1024px) {
	.ig-capsa-floorplan__layout {
		grid-template-columns: 1fr 380px;
	}
}

/* --- Image stage with hotspots --- */
.ig-capsa-floorplan__stage {
	position: relative;
	border-radius: 1rem;
	overflow: hidden;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
	border: 1px solid var(--ig-border);
	background: var(--ig-card);
}

.ig-capsa-floorplan__img {
	width: 100%;
	height: auto;
	display: block;
}

.ig-capsa-hotspot {
	position: absolute;
	margin: 0;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	transition: all 0.3s ease;
}

/* Highlight overlay rectangle. */
.ig-capsa-hotspot__overlay {
	position: absolute;
	inset: 0;
	border-radius: 0.5rem;
	border: 2px solid transparent;
	background: transparent;
	transition: all 0.3s ease;
}

.ig-capsa-hotspot:hover .ig-capsa-hotspot__overlay {
	background: hsl(225 70% 17% / 0.15);
	border-color: rgba(255, 255, 255, 0.4);
}

.ig-capsa-hotspot.is-active .ig-capsa-hotspot__overlay {
	background: hsl(225 70% 17% / 0.25);
	border-color: var(--ig-secondary);
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

/* Label pill (top-left). */
.ig-capsa-hotspot__label {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.75rem;
	font-weight: 700;
	padding: 0.375rem 0.75rem;
	border-radius: 9999px;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
	background: hsl(225 70% 17% / 0.8);
	color: #fff;
	white-space: nowrap;
	transition: all 0.3s ease;
}

.ig-capsa-hotspot__label svg,
.ig-capsa-hotspot__label i {
	width: 0.875rem;
	height: 0.875rem;
	font-size: 0.875rem;
	flex-shrink: 0;
}

.ig-capsa-hotspot:hover .ig-capsa-hotspot__label {
	background: var(--ig-secondary);
	color: var(--ig-secondary-foreground);
}

.ig-capsa-hotspot.is-active .ig-capsa-hotspot__label {
	background: var(--ig-secondary);
	color: var(--ig-secondary-foreground);
	transform: scale(1.1);
	transform-origin: left center;
}

/* Pulsing "ping" dot (bottom-right), hidden when active. */
.ig-capsa-hotspot__ping {
	position: absolute;
	bottom: 0.75rem;
	right: 0.75rem;
	display: inline-flex;
	height: 0.75rem;
	width: 0.75rem;
}

.ig-capsa-hotspot.is-active .ig-capsa-hotspot__ping {
	display: none;
}

.ig-capsa-hotspot__ping::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 9999px;
	background: var(--ig-secondary);
	opacity: 0.75;
	animation: ig-capsa-ping 1.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.ig-capsa-hotspot__ping::after {
	content: '';
	position: relative;
	display: inline-flex;
	height: 0.75rem;
	width: 0.75rem;
	border-radius: 9999px;
	background: var(--ig-secondary);
}

/* --- Detail panel (right column) --- */
.ig-capsa-floorplan__aside {
	position: relative;
}

@media (min-width: 1024px) {
	.ig-capsa-floorplan__aside {
		position: sticky;
		top: 6rem;
	}
}

.ig-capsa-panel {
	background: var(--ig-card);
	border-radius: 1rem;
	padding: 2rem;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
	border: 1px solid var(--ig-border);
	animation: ig-capsa-fade-in 0.3s ease-out both;
}

/* Only one panel visible at a time. */
.ig-capsa-panel[hidden] {
	display: none;
}

.ig-capsa-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1.5rem;
}

.ig-capsa-panel__id {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.ig-capsa-panel__icon {
	width: 3rem;
	height: 3rem;
	border-radius: 0.75rem;
	background: hsl(38 91% 55% / 0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.ig-capsa-panel__icon svg,
.ig-capsa-panel__icon i {
	width: 1.5rem;
	height: 1.5rem;
	font-size: 1.5rem;
	color: var(--ig-secondary);
}

.ig-capsa-panel__eyebrow {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--ig-muted-foreground);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin: 0;
}

.ig-capsa-panel__title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--ig-navy);
	margin: 0.125rem 0 0;
}

.ig-capsa-panel__close {
	border: none;
	background: transparent;
	padding: 0.375rem;
	border-radius: 9999px;
	cursor: pointer;
	line-height: 0;
	color: var(--ig-muted-foreground);
	transition: background-color 0.2s ease;
}

.ig-capsa-panel__close:hover {
	background: var(--ig-muted);
}

.ig-capsa-panel__close svg {
	width: 1rem;
	height: 1rem;
}

.ig-capsa-panel__desc {
	color: var(--ig-muted-foreground);
	font-size: 0.875rem;
	line-height: 1.7;
	margin: 0 0 1.5rem;
}

.ig-capsa-panel__list {
	list-style: none;
	margin: 0 0 2rem;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.ig-capsa-panel__item {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	font-size: 0.875rem;
	line-height: 1.5;
}

.ig-capsa-panel__chevron {
	color: var(--ig-secondary);
	flex-shrink: 0;
	margin-top: 0.125rem;
}

.ig-capsa-panel__chevron svg {
	width: 1rem;
	height: 1rem;
	display: block;
}

.ig-capsa-panel__item span:last-child {
	color: var(--ig-foreground);
}

.ig-capsa-panel__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

/* Empty state (no zone selected). */
.ig-capsa-panel--empty {
	text-align: center;
}

.ig-capsa-panel__empty-icon {
	width: 4rem;
	height: 4rem;
	border-radius: 9999px;
	background: var(--ig-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 1.25rem;
}

.ig-capsa-panel__empty-icon svg {
	width: 1.75rem;
	height: 1.75rem;
	color: var(--ig-muted-foreground);
}

.ig-capsa-panel__empty-title {
	font-size: 1.125rem;
	font-weight: 700;
	color: var(--ig-navy);
	margin: 0 0 0.5rem;
}

.ig-capsa-panel__empty-desc {
	color: var(--ig-muted-foreground);
	font-size: 0.875rem;
	line-height: 1.7;
	margin: 0;
}

.ig-capsa-panel__chips {
	margin-top: 1.5rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
}

.ig-capsa-chip {
	font-size: 0.75rem;
	font-weight: 500;
	padding: 0.375rem 0.75rem;
	border-radius: 9999px;
	border: 1px solid var(--ig-border);
	background: transparent;
	color: var(--ig-foreground);
	cursor: pointer;
	transition: all 0.2s ease;
}

.ig-capsa-chip:hover {
	border-color: var(--ig-secondary);
	color: var(--ig-secondary);
}

/* --- Buttons (shared by panel + CTA) --- */
.ig-capsa-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	border-radius: 9999px;
	padding: 0.625rem 1.5rem;
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.ig-capsa-btn svg {
	width: 1rem;
	height: 1rem;
}

.ig-capsa-btn--gold {
	background: var(--ig-secondary);
	color: var(--ig-secondary-foreground);
	border: 1px solid transparent;
}

.ig-capsa-btn--gold:hover {
	background: var(--ig-gold-light);
	color: var(--ig-secondary-foreground);
}

.ig-capsa-btn--outline {
	background: transparent;
	color: var(--ig-navy);
	border: 1px solid var(--ig-navy);
}

.ig-capsa-btn--outline:hover {
	background: var(--ig-navy);
	color: #fff;
}

/* =========================================================================
   CTA — navy band, centered (Capsa.tsx: py-20 bg-primary)
   ========================================================================= */
.ig-capsa-cta {
	padding: 5rem 0;
	background: var(--ig-surface, var(--ig-navy));
	color: var(--ig-ink, #fff);
	text-align: center;
}

.ig-capsa-cta__eyebrow {
	color: var(--ig-gold-light);
}

.ig-capsa-cta__heading {
	font-size: clamp(1.875rem, 4vw, 2.25rem);
	font-weight: 700;
	color: #fff;
	margin: 0.75rem 0 1rem;
}

.ig-capsa-cta__sub {
	color: rgba(255, 255, 255, 0.7);
	max-width: 36rem;
	margin: 0 auto 2rem;
	line-height: 1.6;
}

.ig-capsa-cta__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	padding: 0.75rem 2.5rem;
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	background: var(--ig-secondary);
	color: var(--ig-secondary-foreground);
	transition: background-color 0.2s ease;
}

.ig-capsa-cta__btn:hover {
	background: var(--ig-gold-light);
}

/* =========================================================================
   Keyframes
   ========================================================================= */
@keyframes ig-capsa-fade-in-up {
	from { opacity: 0; transform: translateY(30px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes ig-capsa-fade-in {
	from { opacity: 0; transform: translateX(20px); }
	to   { opacity: 1; transform: translateX(0); }
}

@keyframes ig-capsa-ping {
	75%, 100% { transform: scale(2); opacity: 0; }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
	.ig-capsa-hero__content,
	.ig-capsa-panel,
	.ig-capsa-hotspot__ping::before {
		animation: none !important;
	}
}
