/* ============================================================
   ForgeOS — window chrome
   ============================================================ */

.window {
	position: absolute;
	display: flex;
	flex-direction: column;
	min-width: 280px;
	min-height: 180px;
	background: var(--steel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
	overflow: hidden;
	resize: both;
	animation: win-open 0.18s ease-out;
	z-index: 10;
}

@keyframes win-open {
	from {
		opacity: 0;
		transform: scale(0.96) translateY(8px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.window.focused {
	border-color: rgba(255, 122, 31, 0.45);
	box-shadow:
		0 22px 56px rgba(0, 0, 0, 0.65),
		0 0 0 1px rgba(255, 122, 31, 0.12),
		0 0 24px rgba(255, 122, 31, 0.1);
}

.window.minimized {
	display: none;
}

.window.maximized {
	inset: 0 0 0 0 !important;
	width: 100% !important;
	height: 100% !important;
	border-radius: 0;
	resize: none;
}

/* ---------- Title bar ---------- */

.titlebar {
	display: flex;
	align-items: center;
	gap: 9px;
	height: 36px;
	padding: 0 6px 0 12px;
	background: linear-gradient(180deg, var(--steel-2), var(--steel));
	border-bottom: 1px solid var(--line-soft);
	user-select: none;
	touch-action: none;
	cursor: grab;
	flex-shrink: 0;
}

.titlebar:active {
	cursor: grabbing;
}

/* ember accent strip on the focused window */
.window.focused .titlebar {
	background:
		linear-gradient(90deg, rgba(255, 122, 31, 0.14), transparent 35%),
		linear-gradient(180deg, var(--steel-2), var(--steel));
}

.titlebar .title-icon {
	display: grid;
	place-items: center;
}

.titlebar .title-icon svg {
	width: 15px;
	height: 15px;
}

.titlebar .title {
	flex: 1;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-dim);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.window.focused .titlebar .title {
	color: var(--text);
}

.titlebar .controls {
	display: flex;
	gap: 4px;
}

.ctl {
	width: 26px;
	height: 24px;
	display: grid;
	place-items: center;
	border: 1px solid transparent;
	border-radius: 5px;
	background: transparent;
	color: var(--text-dim);
	font-family: var(--font-mono);
	font-size: 13px;
	line-height: 1;
	transition: background 0.12s, color 0.12s;
}

.ctl:hover {
	background: rgba(255, 255, 255, 0.08);
	color: var(--text);
}

.ctl.close:hover {
	background: var(--err);
	color: #0b0f15;
}

/* ---------- Window body ---------- */

.window-body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	background: var(--bg-1);
	scrollbar-width: thin;
	scrollbar-color: var(--line) transparent;
}

.window-body iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
	background: #fff;
}
