/* terioto CAD viewer */
.tvc {
	--tvc-height: 480px;
	--tvc-accent: #e8590c;
	--tvc-background: linear-gradient(180deg, #f7f8fa 0%, #e6e9ee 100%);
	--tvc-sheet-background: #eef0f3;
	--tvc-border: #d9dde3;
	--tvc-text: #1d232b;
	--tvc-muted: #5b6470;
	--tvc-bar: #ffffff;
	--tvc-button: #f1f3f6;
	--tvc-button-active: #1d232b;
	--tvc-button-active-text: #ffffff;
	margin: 1.5em 0;
	padding: 0;
	border: 1px solid var(--tvc-border);
	border-radius: 8px;
	overflow: hidden;
	background: var(--tvc-bar);
	color: var(--tvc-text);
	font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	container-type: inline-size;
	max-width: 100%;
}
.tvc *, .tvc *::before, .tvc *::after { box-sizing: border-box; }

/* Tabs */
.tvc-tabs {
	display: flex;
	gap: 2px;
	padding: 6px 8px 0;
	border-bottom: 1px solid var(--tvc-border);
	background: var(--tvc-bar);
}
.tvc .tvc-tab {
	margin: 0 0 -1px;
	padding: 7px 14px;
	border: 1px solid transparent;
	border-bottom: 0;
	border-radius: 6px 6px 0 0;
	background: transparent;
	color: var(--tvc-muted);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	width: auto;
	min-height: 0;
}
.tvc .tvc-tab:hover { color: var(--tvc-text); }
.tvc .tvc-tab[aria-selected="true"] {
	background: var(--tvc-bar);
	border-color: var(--tvc-border);
	color: var(--tvc-text);
	box-shadow: inset 0 2px 0 var(--tvc-accent);
}
.tvc .tvc-tab:focus-visible { outline: 2px solid var(--tvc-accent); outline-offset: -2px; }
.tvc [hidden], .tvc-panel[hidden] { display: none !important; }

/* Stage */
.tvc-stage {
	position: relative;
	height: var(--tvc-height);
	background: var(--tvc-background);
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
}
.tvc-drawing .tvc-stage { background: var(--tvc-sheet-background); cursor: grab; }
.tvc-drawing.tvc--active .tvc-stage:active { cursor: grabbing; }
.tvc--active .tvc-stage { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--tvc-accent) 45%, transparent); }
.tvc-canvas {
	position: relative;
	display: block;
	width: 100% !important;
	height: 100% !important;
	outline: none;
	cursor: grab;
}
.tvc--measuring .tvc-canvas { cursor: crosshair; }

.tvc .tvc-sheet {
	position: absolute;
	left: 8px;
	top: 8px;
	width: calc(100% - 16px);
	height: calc(100% - 16px);
	max-width: none !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	object-fit: contain;
	background: #fff;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
	pointer-events: none;
	-webkit-user-drag: none;
}
.tvc-drawing.tvc--ready .tvc-sheet { object-fit: fill; }

.tvc .tvc-poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	margin: 0 !important;
	border: 0 !important;
	max-width: none !important;
}
.tvc-placeholder {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: #8a929c;
	font-size: 64px;
	font-weight: 700;
	letter-spacing: 0.05em;
	opacity: 0.35;
}
.tvc .tvc-start {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	padding: 0.7em 1.3em;
	border: 0;
	border-radius: 999px;
	background: var(--tvc-text);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
	width: auto;
}
.tvc .tvc-start:hover { background: var(--tvc-accent); }
.tvc--loading .tvc-start { display: none; }

.tvc-info {
	position: absolute;
	left: 50%;
	bottom: 18px;
	transform: translateX(-50%);
	padding: 0.35em 0.9em;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.9);
	font-size: 13px;
	white-space: nowrap;
}
.tvc-info.tvc-error { white-space: normal; text-align: center; width: max-content; max-width: 90%; color: #b00020; }
.tvc-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: rgba(0, 0, 0, 0.06);
}
.tvc-progress > div { height: 100%; width: 0; background: var(--tvc-accent); transition: width 0.2s; }
.tvc-progress.tvc-indeterminate > div { width: 30%; animation: tvc-run 1.2s infinite ease-in-out; }
@keyframes tvc-run { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.tvc-hint {
	position: absolute;
	left: 50%;
	top: 14px;
	transform: translateX(-50%);
	padding: 0.4em 0.9em;
	border-radius: 6px;
	background: rgba(29, 35, 43, 0.85);
	color: #fff;
	font-size: 13px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s;
	max-width: 90%;
	text-align: center;
	z-index: 2;
}
.tvc-hint.tvc-visible { opacity: 1; }

.tvc-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tvc-label {
	position: absolute;
	left: 0;
	top: 0;
	padding: 2px 7px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid var(--tvc-accent);
	color: var(--tvc-text);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.tvc-measure { background: var(--tvc-accent); color: #fff; text-align: center; }
.tvc-measure small { display: block; font-weight: 400; font-size: 10.5px; opacity: 0.9; }

/* Toolbars */
.tvc-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	align-items: center;
	padding: 8px;
	border-top: 1px solid var(--tvc-border);
	background: var(--tvc-bar);
}
.tvc-group { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tvc-right { margin-left: auto; }
.tvc .tvc-button,
.tvc .tvc-select {
	display: inline-flex;
	align-items: center;
	margin: 0;
	padding: 5px 10px;
	min-height: 32px;
	border: 1px solid var(--tvc-border);
	border-radius: 6px;
	background: var(--tvc-button);
	color: var(--tvc-text);
	font: inherit;
	font-size: 13px;
	line-height: 1.2;
	cursor: pointer;
	text-transform: none;
	text-decoration: none;
	letter-spacing: normal;
	box-shadow: none;
	width: auto;
}
.tvc .tvc-button:hover { border-color: var(--tvc-text); }
.tvc .tvc-button[aria-pressed="true"] {
	background: var(--tvc-button-active);
	border-color: var(--tvc-button-active);
	color: var(--tvc-button-active-text);
}
.tvc .tvc-button:focus-visible,
.tvc .tvc-select:focus-visible { outline: 2px solid var(--tvc-accent); outline-offset: 1px; }
.tvc .tvc-clear { color: #b00020; }
.tvc .tvc-button:disabled { opacity: 0.45; cursor: not-allowed; }
.tvc .tvc-button:disabled:hover { border-color: var(--tvc-border); }
.tvc .tvc-slider { width: 110px; margin: 0 4px; accent-color: var(--tvc-accent); cursor: pointer; }
.tvc .tvc-slider[hidden] { display: none; }
.tvc .tvc-select { display: none; padding-right: 6px; }
.tvc-zoom { min-width: 3.6em; text-align: right; font-size: 13px; color: var(--tvc-muted); font-variant-numeric: tabular-nums; }

@container (max-width: 640px) {
	.tvc .tvc-views { display: none; }
	.tvc .tvc-select { display: inline-flex; }
	.tvc-right { margin-left: 0; }
}

/* Title and downloads */
.tvc-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	align-items: center;
	justify-content: space-between;
	padding: 8px 10px;
	font-size: 13px;
	color: var(--tvc-muted);
	border-top: 1px solid var(--tvc-border);
}
.tvc-title { font-weight: 600; color: var(--tvc-text); }
.tvc-downloads { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; }
.tvc-downloads li { margin: 0; padding: 0; }
.tvc-downloads a { color: inherit; text-decoration: none; font-weight: 600; }
.tvc-downloads a:hover { color: var(--tvc-accent); }
.tvc-downloads a::before { content: "↓ "; color: var(--tvc-accent); }
.tvc-downloads small { font-weight: 400; color: var(--tvc-muted); }

/* Fullscreen (also the overlay fallback on iPhone) */
.tvc.tvc--fullscreen {
	position: fixed;
	inset: 0;
	z-index: 999999;
	margin: 0;
	border: 0;
	border-radius: 0;
	display: flex;
	flex-direction: column;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
}
.tvc.tvc--fullscreen .tvc-panel:not([hidden]) { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tvc.tvc--fullscreen .tvc-stage { flex: 1; height: auto !important; }
.tvc.tvc--fullscreen .tvc-footer { display: none; }
html.tvc-noscroll, html.tvc-noscroll body { overflow: hidden !important; }

/* Narrow boxes: the drawing stage follows the sheet's landscape format instead of the fixed height. */
@container (max-width: 640px) {
	.tvc-drawing .tvc-stage { height: min(var(--tvc-height), 78cqw); }
}
