/*******************************************************/
/* Faux browser window — shared by the html editor and the page builder
/*******************************************************/

.faux-browser {
	position: relative;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	min-width: 0;
	max-width: 100%;
	background: #fff;
	border: 1px solid #d5d7e0;
	/* Closed on all four sides now that the stage leaves room beneath it. It
	   used to run off the bottom edge — bottom border and bottom radius both
	   dropped — because it was flush against the code pane and a closed edge
	   there would have read as a second border beside the pane's own. Given a
	   gap, an open edge reads as a window someone forgot to finish. */
	border-radius: 8px;
	box-shadow: 0 6px 24px rgba(16, 24, 40, .12);
	overflow: hidden;
}

.faux-browser__chrome {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
	height: 34px;
	padding: 0 12px;
	background: linear-gradient(#f7f8fa, #eceef3);
	border-bottom: 1px solid #dcdee6;
}

.faux-browser__dots {
	display: inline-flex;
	gap: 6px;
	flex: 0 0 auto;
}

.faux-browser__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #d6d8e0;
}

.faux-browser__dot:nth-child(1) { background: #ec6a5e; }
.faux-browser__dot:nth-child(2) { background: #f4bf4f; }
.faux-browser__dot:nth-child(3) { background: #61c554; }

.faux-browser__location {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	background: #fff;
	border: 1px solid #dcdee6;
	border-radius: 100px;
	padding: 3px 12px;
	font-size: 11px;
	color: #4b5563;
	text-align: center;
	text-decoration: none;
}

/* The address is the way to the live page: a link when there is one. The text
   and the icon are separate children so the ellipsis still works under flex. */
.faux-browser__location--link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.faux-browser__location-text {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* The external-link mark takes its room always (so the address does not
   shift on hover) and only becomes visible with the pointer over the link. */
.faux-browser__location-icon {
	flex: 0 0 auto;
	opacity: 0;
	transition: opacity 120ms ease;
}

a.faux-browser__location:hover,
a.faux-browser__location:focus-visible {
	color: #111827;
	border-color: #b8bcc8;
	text-decoration: underline;
}

a.faux-browser__location:hover .faux-browser__location-icon,
a.faux-browser__location:focus-visible .faux-browser__location-icon {
	opacity: 1;
}

.faux-browser__rendering {
	flex: 0 0 auto;
	font-size: 11px;
	color: #6b7280;
	white-space: nowrap;
}

.faux-browser__body {
	flex: 1;
	min-height: 0;
	display: flex;
	background: #fff;
}

/* The side edges. Wider than they look: the visible line is 1px of border, the
   grab area is 10px, because a 1px drag target is a 1px drag target. */
.faux-browser__grip {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 10px;
	cursor: ew-resize;
	touch-action: none;
	z-index: 2;
	background: transparent;
	transition: background .15s;
}

.faux-browser__grip--left { left: -5px; }
.faux-browser__grip--right { right: -5px; }

.faux-browser__grip:hover,
.faux-browser__grip:focus,
.faux-browser__grip:active {
	background: rgba(47, 117, 230, .35);
	outline: none;
}

/* Locked to a width (a page-builder breakpoint): no shrinking to fit. Centred by
   auto margins rather than the parent's justify-content, because a centred flex
   item wider than its container overflows BOTH sides and its left edge can never
   be scrolled to; an auto margin collapses to nothing instead, leaving it flush
   left and the rest reachable by scrolling. */
.faux-browser--locked {
	flex: none;
	max-width: none;
	margin: 0 auto;
}

/* The width and zoom of a window zoomed out to fit. On the stage, NOT in the
   window's bar: the bar is scaled with the window and would be unreadable. */
.faux-browser-zoom-note {
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 3;
	padding: 2px 8px;
	border-radius: 100px;
	background: rgba(17, 24, 39, .75);
	color: #fff;
	font-size: 11px;
	line-height: 18px;
	white-space: nowrap;
	pointer-events: none;
}

/* Zooming a window out to fit its stage (PreviewStage: base narrower than XL + 1;
   HtmlEditor: a window dragged wider than the stage). Both boxes are always
   rendered — swapping wrappers in and out would remount the iframe, i.e. reload
   the page — and are plain pass-through flex boxes until --on, when the inner one
   is laid out at full size and transformed and the outer one clips its unscaled
   layout box. */
.faux-browser-scaler { position: relative; flex: 1; min-width: 0; display: flex; }
/* flex-start, not center: a centred item wider than its box overflows both
   sides and its left edge can't be scrolled to. The window centres itself with
   auto margins instead (.faux-browser), which collapse when there's no room. */
.faux-browser-scaled { flex: 1; min-width: 0; display: flex; justify-content: flex-start; align-items: stretch; }
.faux-browser-scaler--on { overflow: hidden; }
.faux-browser-scaler--on .faux-browser-scaled { flex: none; transform-origin: 0 0; }
