/* The workspace: Layers panel + canvas, the boards (frames) that sit on the canvas,
   the floating toolbar/zoom, Preview mode, and the small-screen version (chrome dropped). */

.dba-workspace {
	display: block;
}

.dba-shell .dba-workspace {
	display: grid;
	grid-template-columns: var(--dba-panel-live) minmax(0, 1fr);
}

.dba-shell .dba-main {
	min-height: calc(100vh - var(--dba-bar-h));
	padding: 1.75rem clamp(1rem, 2.4vw, 2.25rem) 6rem;
}

/* A board = one section on the canvas */
.dba-board {
	max-width: var(--dba-frame-max);
	margin-inline: auto;
	scroll-margin-top: calc(var(--dba-bar-h) + var(--dba-adminbar) + 1rem);
}

.dba-board + .dba-board {
	margin-top: 2.5rem;
}

.dba-board__label {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-bottom: 0.5rem;
	color: var(--dba-muted);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1;
}

.dba-board__label .dba-icon {
	width: 1.125rem;
	height: 1.125rem;
}

.dba-board.is-active .dba-board__label {
	color: var(--dba-accent);
}

/* The box is the size container the section's proportions (cqi units) are measured against. */
.dba-board__box {
	position: relative;
	container-type: inline-size;
}

.dba-screen {
	background: var(--dba-surface);
	border: 1px solid var(--dba-line);
}

/* Selection outline, 8 handles and size badge: only on the active board */
.dba-sel {
	position: absolute;
	inset: 0;
	border: 1px solid var(--dba-accent);
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--dba-dur-s) var(--dba-ease);
}

.dba-board.is-active .dba-sel,
.dba-board.is-active .dba-badge {
	opacity: 1;
}

.dba-sel i {
	position: absolute;
	width: 0.5rem;
	height: 0.5rem;
	margin: -0.25rem;
	background: var(--dba-surface);
	border: 1px solid var(--dba-accent);
}

.dba-sel i:nth-child(1) { top: 0;    left: 0; }
.dba-sel i:nth-child(2) { top: 0;    left: 50%; }
.dba-sel i:nth-child(3) { top: 0;    left: 100%; }
.dba-sel i:nth-child(4) { top: 50%;  left: 0; }
.dba-sel i:nth-child(5) { top: 50%;  left: 100%; }
.dba-sel i:nth-child(6) { top: 100%; left: 0; }
.dba-sel i:nth-child(7) { top: 100%; left: 50%; }
.dba-sel i:nth-child(8) { top: 100%; left: 100%; }

.dba-badge {
	position: absolute;
	top: 100%;
	left: 50%;
	padding: 0.2rem 0.6rem;
	border-radius: 0.375rem;
	background: var(--dba-accent);
	color: var(--dba-accent-ink);
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	opacity: 0;
	transform: translate(-50%, -35%);
	pointer-events: none;
	transition: opacity var(--dba-dur-s) var(--dba-ease);
}

/* Floating toolbar (the tools work, see tools.js) and zoom control (decorative) */
.dba-toolbar {
	position: fixed;
	bottom: 0.875rem;
	left: calc(var(--dba-panel-live) + (100vw - var(--dba-panel-live)) / 2);
	z-index: 60;
	display: flex;
	gap: 0.125rem;
	padding: 0.25rem;
	background: var(--dba-surface);
	border: 1px solid var(--dba-line);
	border-radius: 0.75rem;
	box-shadow: var(--dba-shadow-s);
	transform: translateX(-50%);
}

.dba-toolbar button {
	position: relative;
	display: grid;
	place-items: center;
	width: 2.125rem;
	height: 2.125rem;
	padding: 0;
	border: 0;
	border-radius: var(--dba-radius-s);
	background: transparent;
	color: var(--dba-ink-soft);
	cursor: pointer;
	transition: background-color var(--dba-dur-s) var(--dba-ease), color var(--dba-dur-s) var(--dba-ease);
}

.dba-toolbar button:hover:not(.is-on) {
	background: var(--dba-canvas);
	color: var(--dba-ink);
}

.dba-toolbar button.is-on {
	background: var(--dba-accent);
	color: var(--dba-accent-ink);
}

.dba-toolbar [hidden] {
	display: none;
}

.dba-toolbar__sep {
	align-self: center;
	width: 1px;
	height: 1.25rem;
	margin: 0 0.25rem;
	background: var(--dba-line);
}

.dba-toolbar .dba-icon {
	width: 1.125rem;
	height: 1.125rem;
}

/* Name of the tool, above the button */
.dba-toolbar button::after {
	content: attr(data-tip);
	position: absolute;
	bottom: calc(100% + 0.625rem);
	left: 50%;
	padding: 0.32rem 0.55rem;
	border-radius: 0.3rem;
	background: var(--dba-ink);
	color: var(--dba-surface);
	font-size: 0.6875rem;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	opacity: 0;
	transform: translateX(-50%) translateY(3px);
	pointer-events: none;
	transition: opacity 0.15s, transform 0.2s;
}

.dba-toolbar button:hover::after,
.dba-toolbar button:focus-visible::after {
	opacity: 1;
	transform: translateX(-50%);
}

.dba-zoom {
	position: fixed;
	right: 1.25rem;
	bottom: 0.875rem;
	z-index: var(--dba-z-panel);
	display: flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.45rem 0.65rem;
	background: var(--dba-surface);
	border: 1px solid var(--dba-line);
	border-radius: var(--dba-radius-s);
	font-size: 0.8125rem;
	font-weight: 600;
	pointer-events: none;
}

.dba-zoom .dba-icon {
	width: 0.9rem;
	height: 0.9rem;
	color: var(--dba-muted);
}

/* Preview mode: the chrome disappears, the sections run together as a normal website */
.is-preview {
	background: var(--dba-surface);
}

.is-preview .dba-layers,
.is-preview .dba-toolbar,
.is-preview .dba-zoom,
.is-preview .dba-board__label,
.is-preview .dba-sel,
.is-preview .dba-badge {
	display: none;
}

.is-preview .dba-workspace {
	display: block;
}

.is-preview .dba-main {
	padding: 0;
}

.is-preview .dba-board {
	max-width: none;
}

.is-preview .dba-board + .dba-board {
	margin-top: 0;
}

.is-preview .dba-screen {
	border-color: transparent;
}

/* The WordPress admin bar pushes the sticky bars down */
.admin-bar {
	--dba-adminbar: 32px;
}

@media (max-width: 782px) {
	.admin-bar {
		--dba-adminbar: 46px;
	}
}

@media (max-width: 600px) {
	.admin-bar {
		--dba-adminbar: 0px;
	}
}

/* Resizable boards (see assets/js/frames.js). Only the ACTIVE board (the selected one) has handles and can be resized,
   and only in width; the height follows the content. Hovering any other board just shows its blue border.
   Width: --dba-w, left edge: --dba-x. */
html:not([data-dba-tool="inspect"]) .dba-board:hover .dba-sel,
.dba-board.is-resizing .dba-sel {
	opacity: 1;
}

.dba-board[data-dba-resized] {
	width: var(--dba-w);
	max-width: min(100%, var(--dba-frame-max));
	margin-left: var(--dba-x, auto);
}

/* On hover only the border shows; the handles belong to the active board */
.dba-sel i {
	visibility: hidden;
}

.dba-board.is-active .dba-sel i,
.dba-board.is-resizing .dba-sel i {
	visibility: visible;
}

/* The side and corner handles of the active board can be grabbed (all drag the width); the top and bottom ones are just marks */
.dba-board.is-active .dba-sel i:not(:nth-child(2)):not(:nth-child(7)),
.dba-board.is-resizing .dba-sel i:not(:nth-child(2)):not(:nth-child(7)) {
	pointer-events: auto;
	cursor: ew-resize;
}

.dba-board.is-active .dba-sel i:not(:nth-child(2)):not(:nth-child(7))::before,
.dba-board.is-resizing .dba-sel i:not(:nth-child(2)):not(:nth-child(7))::before {
	content: "";
	position: absolute;
	inset: -0.5rem; /* a larger target around each handle */
}

html.dba-resizing,
html.dba-resizing * {
	cursor: ew-resize !important;
	user-select: none !important;
}

/* Fixed boards (Contact, Services, the closing call to action): the selection border and size badge show, but no handles */
.dba-board--fixed .dba-sel i {
	display: none;
}

/* The left panel comes after <main> in the HTML (keyboard users reach the content first); the grid keeps it on the left */
.dba-shell .dba-layers {
	grid-column: 1;
	grid-row: 1;
}

.dba-shell .dba-main {
	grid-column: 2;
	grid-row: 1;
}

.dba-layers-closed .dba-shell .dba-main {
	grid-column: 1;
}
