/*
 * Layout of a converted Sandcastle web pack. It is copied into every pack when the pack is stored.
 *
 * This file states only what the script of the pack depends on: the tree beside the topic, each scrolling
 * by itself, and what is shown of a branch or a section that is closed. Fonts, colours and everything else
 * a reader would call the look of the pack is stated by the stylesheet linked after this one (default.css),
 * which is the document style of the portal, or gn_sandcastle.css when the document names none.
 */

html {
	height: 100%;
}

/* The page itself never scrolls: it fills the frame it is read in, and its two columns scroll. It is fixed
   to the frame instead of being given its height, so a zoom written into the page keeps it inside. */
body.atl-pack {
	position: fixed;
	inset: 0;
	margin: 0;
	display: grid;
	grid-template-columns: minmax(220px, 26%) minmax(0, 1fr);
	overflow: hidden;
}

.atl-pack-tree {
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.atl-pack-topic {
	min-width: 0;
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
}

/* Tree */

.atl-pack-tree-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.atl-pack-tree-list .atl-pack-tree-list {
	padding-left: 16px;
}

.atl-pack-tree-list[hidden] {
	display: none;
}

.atl-pack-tree-row {
	display: flex;
	align-items: flex-start;
}

.atl-pack-tree-toggle,
.atl-pack-tree-leaf {
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
}

.atl-pack-tree-toggle {
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.atl-pack-tree-row a {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
}

/* Topic */

.collapsibleRegionTitle {
	cursor: pointer;
}

.collapsibleAreaRegion.atl-pack-closed + .collapsibleSection {
	display: none;
}

/* A narrow frame has no room for two columns: the tree stands above the topic and the page scrolls as one. */
@media (max-width: 760px) {
	html {
		height: auto;
	}

	body.atl-pack {
		position: static;
		display: block;
		overflow: visible;
	}

	.atl-pack-tree {
		max-height: 40vh;
	}

	.atl-pack-topic {
		overflow: visible;
	}
}

/* Paper has no use for the tree. */
@media print {
	body.atl-pack {
		position: static;
		display: block;
		overflow: visible;
	}

	.atl-pack-tree {
		display: none;
	}

	.atl-pack-topic {
		overflow: visible;
	}
}
