/**
 * Cruise Itinerary Map — frontend styles.
 *
 * Scoped under .cim-wrap so it can be embedded inside any theme without
 * leaking selectors. All custom property declarations are namespaced
 * (--cim-*) for the same reason.
 */

.cim-wrap {
	--cim-paper: #FBFAF7;
	--cim-paper-warm: #F5F2EA;
	--cim-paper-warmer: #EFEAD8;
	--cim-coast: #B5A988;
	--cim-coast-soft: #D4CCB4;
	--cim-ink: #1a3a5c;
	--cim-ink-soft: #2a2418;
	--cim-sepia: #8a7a5a;
	--cim-card-bg: #FBFAF7;
	--cim-card-border: #B5A988;
	--cim-sub: #8a7a5a;

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	color: var(--cim-ink-soft);
	max-width: 100%;
	margin: 0 auto;
	box-sizing: border-box;
}
.cim-wrap *, .cim-wrap *::before, .cim-wrap *::after { box-sizing: inherit; }

.cim-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin: 0 0 1rem;
	padding: 0 4px;
	gap: 1rem;
}

.cim-title {
	font-family: Georgia, "Times New Roman", serif;
	font-size: 20px;
	letter-spacing: 0.02em;
	color: var(--cim-ink-soft);
	font-weight: 500;
}

.cim-meta {
	font-size: 12px;
	color: var(--cim-sub);
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.cim-map {
	background: var(--cim-paper);
	border: 0.5px solid var(--cim-coast-soft);
	border-radius: 8px;
	overflow: hidden;
	position: relative;
	aspect-ratio: 680 / 420;
}

.cim-svg {
	display: block;
	width: 100%;
	height: 100%;
}

.cim-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	letter-spacing: 0.18em;
	color: var(--cim-sepia);
	text-transform: uppercase;
	pointer-events: none;
	transition: opacity 0.4s;
}

.cim-cards {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.cim-card {
	position: absolute;
	width: 185px;
	background: var(--cim-card-bg);
	border: 0.5px solid var(--cim-card-border);
	border-radius: 5px;
	padding: 0;
	overflow: hidden;
	box-shadow: 0 2px 12px rgba(42, 36, 24, 0.18);
	opacity: 0;
	transition: opacity 0.4s ease;
	pointer-events: none;
	z-index: 10;
}
.cim-card.visible { opacity: 1; }
.cim-card.a-left { transform: translate(0, -50%); }
.cim-card.a-right { transform: translate(-100%, -50%); }
.cim-card.a-top { transform: translate(-50%, 0); }
.cim-card.a-bottom { transform: translate(-50%, -100%); }

.cim-card-img {
	position: relative;
	width: 100%;
	background: #f5f0e0;
	aspect-ratio: 5 / 3;
	display: block;
}
.cim-card-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Subtitle as a gradient-faded caption overlaying the image bottom.
 * The gradient fades from transparent at the top of the strip into
 * dark at the bottom, giving the text a legible backdrop without
 * harshly cropping the image. */
.cim-card-sub-overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 26px 11px 8px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0.78) 100%);
	color: #f3ece0;
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	line-height: 1.2;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
	pointer-events: none;
}

/* Subtitle-only fallback (no image present). Plain text on paper bg. */
.cim-card > .cim-card-sub:not(.cim-card-sub-overlay) {
	padding: 10px 11px;
	font-size: 12px;
	color: var(--cim-sub);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	line-height: 1.2;
}

.cim-controls {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px 18px;
	border-top: 0.5px solid var(--cim-coast-soft);
	background: var(--cim-paper);
	border-radius: 0 0 8px 8px;
	margin-top: -1px;
}
.cim-btn {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 0.5px solid var(--cim-coast);
	background: transparent;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--cim-ink-soft);
	padding: 0;
	font: inherit;
	flex-shrink: 0;
}
.cim-btn:hover { background: rgba(0, 0, 0, 0.04); }
.cim-btn:focus-visible {
	outline: 2px solid var(--cim-ink);
	outline-offset: 2px;
}
.cim-progress {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}
.cim-bar {
	height: 2px;
	background: var(--cim-coast-soft);
	border-radius: 1px;
	position: relative;
	overflow: hidden;
}
.cim-bar-fill {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	background: var(--cim-ink);
	width: 0%;
}
.cim-leg {
	font-size: 12px;
	color: var(--cim-sub);
	letter-spacing: 0.04em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.cim-leg strong { font-weight: 500; color: var(--cim-ink-soft); }

.cim-error {
	padding: 8px 12px;
	border-left: 3px solid #c33;
	background: #fff5f5;
	color: #900;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	font-size: 13px;
}

/* Reduced motion: stop the auto-progress and rotation, keep static map. */
@media (prefers-reduced-motion: reduce) {
	.cim-card { transition: none; }
}
