/* O11Y topology + Retals project stages (inside showcase-box) */

.project-stage {
	position: absolute;
	inset: 0;
	z-index: 1;
	overflow: hidden;
	border-radius: inherit;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.showcase-box > .project-stage {
	transition:
		transform var(--pane-duration, 0.55s) var(--pane-ease, cubic-bezier(0.22, 1, 0.36, 1)),
		opacity 0.45s ease,
		visibility 0s linear 0.45s;
}

.project-stage.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: none;
}

.showcase-box > .project-stage.is-active {
	transition:
		transform var(--pane-duration, 0.55s) var(--pane-ease, cubic-bezier(0.22, 1, 0.36, 1)),
		opacity 0.45s ease,
		visibility 0s linear 0s;
}

.showcase-box.is-framed .project-card-title,
.showcase-box.is-framed .project-card-year {
	text-shadow: 0 1px 16px var(--color-background);
}

.topology-stage {
	color: var(--color-text-ultra-subtle);
	background-color: var(--color-background-bold);
}

.showcase-box.is-framed:has(.topology-stage.is-active) {
	background-color: var(--color-background-bold);
}

.retals-stage {
	color: var(--color-text-muted);
}

.retals-shader {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: block;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.topology-stage canvas {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: block;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.topology-graph {
	position: absolute;
	inset: 0;
	z-index: 1;
	overflow: hidden;
	pointer-events: none;
}

.topology-svg {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.topology-link {
	fill: none;
	stroke: var(--color-border);
	stroke-width: 1;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: 0;
	transition:
		opacity 0.42s ease,
		stroke-dashoffset 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.topology-link.is-in {
	opacity: 0.38;
}

.topology-link--dotted {
	stroke: var(--color-border);
	stroke-dasharray: 2.5 6;
	stroke-linecap: round;
	transition: opacity 0.4s ease;
}

.topology-link--dotted.is-in {
	opacity: 0.32;
}

.topology-link-pulse {
	fill: none;
	stroke: var(--color-primary-bright);
	stroke-width: 1.15;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 2 5 4 120;
	stroke-dashoffset: 0;
	opacity: 0;
	filter: drop-shadow(0 0 3px color-mix(in srgb, var(--color-primary-bright) 50%, transparent));
	pointer-events: none;
}

.topology-link-pulse.is-in {
	opacity: 0.8;
	animation: topology-packet var(--packet-dur, 1.1s) linear var(--packet-delay, 0s) infinite;
}

@keyframes topology-packet {
	to {
		stroke-dashoffset: calc(-1 * var(--packet-cycle, 220px));
	}
}

.topology-node {
	position: absolute;
	z-index: 2;
	box-sizing: border-box;
	width: 14px;
	height: 14px;
	margin: 0;
	padding: 0;
	border-radius: 50%;
	background-color: var(--color-icon-subtler);
	opacity: 0;
	transform: translate(-50%, -50%) translateX(-16px) scale(0.2);
	transform-origin: center;
	will-change: transform, opacity;
}

.topology-node.is-in {
	opacity: 1;
	transform: translate(-50%, -50%) translateX(0) scale(1);
	transition:
		opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.46s cubic-bezier(0.22, 1, 0.36, 1),
		color 0.5s ease,
		border-color 0.5s ease,
		background-color 0.5s ease,
		box-shadow 0.5s ease;
}

.topology-node--device,
.topology-node--isp,
.topology-node--asn {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	background-color: var(--color-background-bold);
	border: 1px solid var(--color-border);
	box-shadow: none;
	color: var(--color-icon-subtler);
}

.topology-node--isp.is-healthy,
.topology-node--asn.is-healthy {
	color: var(--color-primary-bright);
	border-color: var(--color-border);
	background-color: var(--color-background-bold);
	box-shadow: none;
}

.topology-node--isp.is-alert,
.topology-node--asn.is-alert {
	color: var(--color-icon-red);
	border-color: color-mix(in srgb, var(--color-error) 70%, var(--color-border));
	background-color: var(--color-background-bold);
	box-shadow: none;
}

.topology-node--aws {
	width: 50px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	border-radius: 999px;
	background-color: var(--color-background-bold);
	border: 1px solid color-mix(in srgb, var(--color-brand-aws) 50%, var(--color-border));
	box-shadow: none;
	color: var(--color-text);
}

.topology-node--empty {
	z-index: 3;
	width: 16px;
	height: 16px;
	background-color: var(--color-background-bold);
	border: 1.5px solid var(--color-text-subtlest);
	box-shadow: 0 0 0 3px var(--color-background-bold);
}

.topology-icon {
	display: block;
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
	overflow: visible;
}

.topology-icon--aws {
	width: 26px;
	height: auto;
	aspect-ratio: 304 / 182;
	color: var(--color-text);
}

.topology-graph[data-show='core'] .topology-node[data-role='hop'],
.topology-graph[data-show='core'] .topology-link[data-role='hop'],
.topology-graph[data-show='core'] .topology-link-pulse[data-role='hop'] {
	opacity: 0 !important;
	visibility: hidden;
}

.topology-graph[data-show='all'] .topology-link[data-role='core'],
.topology-graph[data-show='all'] .topology-link-pulse[data-role='core'] {
	opacity: 0 !important;
	visibility: hidden;
}

.topology-controls {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 6;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	padding: 0;
	border: 0;
	background: transparent;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 10px;
	line-height: 1.2;
	letter-spacing: 0.01em;
	pointer-events: none;
	user-select: none;
	opacity: 0;
	transform: translateY(-4px);
	transition:
		opacity 0.55s ease,
		transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.topology-controls.is-in {
	opacity: 1;
	transform: translateY(0);
}

.topology-control {
	display: flex;
	align-items: center;
	gap: 10px;
}

.topology-control__label {
	flex: 0 0 auto;
	color: var(--color-text-subtlest);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.topology-control__pills {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 2px;
	border-radius: 999px;
	background-color: color-mix(in srgb, var(--color-background) 45%, var(--color-surface));
	border: 1px solid var(--color-border);
}

.topology-control__pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px 8px;
	border-radius: 999px;
	color: var(--color-text-subtlest);
	white-space: nowrap;
}

.topology-control__pill.is-selected {
	background-color: var(--color-chip);
	color: var(--color-text);
}

.topology-metrics {
	position: absolute;
	left: 20px;
	right: 20px;
	bottom: 16px;
	z-index: 4;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 18px 22px;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 10px;
	line-height: 1.2;
	letter-spacing: 0.01em;
	pointer-events: none;
	opacity: 0;
	transform: translateY(4px);
	transition:
		opacity 0.55s ease,
		transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.topology-metrics.is-in {
	opacity: 1;
	transform: translateY(0);
}

.topology-metric {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	white-space: nowrap;
}

.topology-metric__label {
	color: var(--color-text-subtlest);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.topology-metric__value {
	color: var(--color-text-subtler);
	font-variant-numeric: tabular-nums;
}

.topology-aws-word {
	fill: currentColor;
}

.topology-aws-smile {
	fill: var(--color-brand-aws);
}

@media (prefers-reduced-motion: reduce) {
	.topology-node,
	.topology-link,
	.topology-link--dotted.is-in,
	.topology-link.is-in,
	.topology-node.is-in {
		transition: none;
	}

	.topology-node {
		transform: translate(-50%, -50%) scale(1);
	}

	.topology-link-pulse.is-in {
		animation: none;
		opacity: 0;
	}

	.topology-metrics,
	.topology-metrics.is-in,
	.topology-controls,
	.topology-controls.is-in {
		transition: none;
		transform: none;
	}
}

@media (max-width: 768px) {
	.topology-node--device,
	.topology-node--isp,
	.topology-node--asn {
		width: 34px;
		height: 34px;
	}

	.topology-node--aws {
		width: 46px;
		height: 28px;
	}

	.topology-icon {
		width: 16px;
		height: 16px;
	}

	.topology-icon--aws {
		width: 24px;
	}
}

.showcase-box > .retals-stage.is-active {
	pointer-events: auto;
}

.showcase-box.is-framed:has(.retals-stage.is-active) .project-card-meta {
	pointer-events: none;
}

.showcase-box.is-framed.has-retals-pick {
	box-shadow: inset 0 0 0 1px var(--retals-pick);
	transition: box-shadow 0.9s ease;
}

.retals-word {
	position: absolute;
	left: 50%;
	top: 48%;
	z-index: 2;
	display: grid;
	place-items: center;
	transform: translate(-50%, -50%);
	line-height: 1;
	user-select: none;
	cursor: default;
	mix-blend-mode: overlay;
}

.retals-word__layer {
	grid-area: 1 / 1;
	font-family: 'Redaction', 'Times New Roman', Times, serif;
	font-style: italic;
	font-weight: 400;
	font-size: clamp(2.5rem, 8vw, 5.25rem);
	letter-spacing: -0.04em;
	line-height: 0.85;
	color: var(--color-text);
	font-synthesis: none;
	white-space: nowrap;
	text-align: center;
	transform-origin: center;
	opacity: 0;
}

.retals-word__layer.is-base {
	opacity: 1;
}

.retals-word__layer:not(.is-base) {
	-webkit-font-smoothing: none;
}

.retals-picker {
	position: absolute;
	left: 50%;
	bottom: 20px;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	border-radius: 999px;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	transform: translateX(-50%);
}

.retals-swatch {
	box-sizing: border-box;
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	appearance: none;
	background: transparent;
	box-shadow: inset 0 0 0 1px var(--color-border-subtle);
	cursor: pointer;
}

.retals-swatch:hover {
	transform: scale(1.12);
}

.retals-swatch.is-selected {
	box-shadow:
		0 0 0 2px var(--color-surface),
		0 0 0 4px var(--retals-pick, currentColor);
}

@media (prefers-reduced-motion: reduce) {
	.retals-swatch:hover {
		transform: none;
	}

	.showcase-box.is-framed.has-retals-pick {
		transition: none;
	}
}

@media (max-width: 768px) {
	.retals-word__layer {
		font-size: clamp(2rem, 12vw, 3.75rem);
	}

	.retals-picker {
		gap: 8px;
		padding: 8px 12px;
		bottom: 14px;
	}
}

.retals-popover {
	position: absolute;
	z-index: 6;
	box-sizing: border-box;
	min-width: 220px;
	padding: 14px 16px 12px;
	border-radius: 12px;
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	box-shadow: 0 12px 32px color-mix(in srgb, var(--color-background) 55%, transparent);
	color: var(--color-text);
}

.retals-popover-close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--color-text-muted);
	cursor: pointer;
}

.retals-popover-close:hover {
	background-color: var(--color-surface-hover);
	color: var(--color-text);
}

.retals-popover-title {
	margin: 0 28px 10px 0;
	font-family: 'Geist', sans-serif;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	text-transform: capitalize;
	color: var(--color-text);
}

.retals-popover-table {
	width: 100%;
	border-collapse: collapse;
	font-family: 'IBM Plex Mono', monospace;
	font-size: 0.6875rem;
	line-height: 1.3;
}

.retals-popover-table td {
	padding: 4px 0;
	vertical-align: middle;
	white-space: nowrap;
}

.retals-popover-table td:nth-child(2) {
	padding-left: 10px;
	padding-right: 12px;
	color: var(--color-text);
}

.retals-popover-table td:nth-child(3) {
	color: var(--color-text-muted);
}

.retals-popover-table tr.is-500 td:nth-child(2),
.retals-popover-table tr.is-500 td:nth-child(3) {
	color: var(--color-text);
	font-weight: 500;
}

.retals-chip {
	display: block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px var(--color-border-subtle);
}

.photography-stage {
	background-color: var(--color-background);
}

.showcase-box.is-framed:has(.photography-stage.is-active) {
	background-color: var(--color-background);
}

.photography-stage::after {
	content: '';
	position: absolute;
	inset: 0 0 auto 0;
	height: 96px;
	z-index: 2;
	pointer-events: none;
	background: linear-gradient(
		to bottom,
		color-mix(in srgb, var(--color-background) 58%, transparent),
		transparent
	);
}

.photography-grid {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: grid;
	gap: 2px;
	width: 100%;
	height: 100%;
	grid-template-columns: repeat(var(--photo-cols, 4), minmax(0, 1fr));
	grid-template-rows: repeat(var(--photo-rows, 3), minmax(0, 1fr));
	background-color: var(--color-background);
}

.photography-cell {
	position: relative;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	background-color: var(--color-surface);
	grid-column: var(--photo-c) / span var(--photo-cs);
	grid-row: var(--photo-r) / span var(--photo-rs);
}

.photography-cell img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	opacity: 0;
	transition: opacity 0.28s ease var(--photo-delay, 0ms);
}

.photography-cell.is-ready img {
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	.photography-cell img,
	.photography-cell.is-ready img {
		transition: none;
		opacity: 1;
	}
}
