/**
 * Golamac Documents — front end.
 *
 * Every rule is scoped under .gmdocs-root. There are no element selectors at
 * document scope, no framework classes, and nothing here targets anything the
 * theme owns. The four custom properties below are the restyling surface: a
 * child theme overrides them rather than fighting this file.
 */

.gmdocs-root {
	--gmdocs-border: #e2e4e8;
	--gmdocs-text: inherit;
	/* Brand-neutral by default. Set "Accent colour" in Documents -> Settings,
	   or override this one property in the child theme. */
	--gmdocs-accent: currentColor;
	--gmdocs-link: var(--gmdocs-accent);
	--gmdocs-row-hover: rgba(0, 0, 0, 0.03);
	--gmdocs-muted: rgba(0, 0, 0, 0.6);
	--gmdocs-focus: currentColor;
	--gmdocs-gap: 1rem;

	color: var(--gmdocs-text);
}

@media (prefers-color-scheme: dark) {
	.gmdocs-root {
		--gmdocs-border: rgba(255, 255, 255, 0.18);
		--gmdocs-row-hover: rgba(255, 255, 255, 0.05);
		--gmdocs-muted: rgba(255, 255, 255, 0.65);
	}
}

.gmdocs-root a {
	color: var(--gmdocs-link);
}

.gmdocs-download,
.gmdocs-folder__name {
	color: var(--gmdocs-accent);
}

.gmdocs-download--primary {
	font-weight: 600;
}

/* Focus visibility is a WCAG 2.1 AA obligation on a public-agency site, so it
   is never removed — only made consistent. */
.gmdocs-root a:focus-visible,
.gmdocs-root button:focus-visible,
.gmdocs-root input:focus-visible,
.gmdocs-root summary:focus-visible {
	outline: 2px solid var(--gmdocs-focus);
	outline-offset: 2px;
}

.gmdocs-visually-hidden {
	position: absolute !important; /* Must beat theme positioning to stay off-screen. */
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Breadcrumb ------------------------------------------------------------- */

.gmdocs-breadcrumb__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0 0 var(--gmdocs-gap);
	padding: 0;
	list-style: none;
	font-size: 0.9em;
}

.gmdocs-breadcrumb__item + .gmdocs-breadcrumb__item::before {
	content: "/";
	margin-right: 0.35rem;
	color: var(--gmdocs-muted);
}

/* Search ----------------------------------------------------------------- */

.gmdocs-search {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.5rem;
	margin-bottom: var(--gmdocs-gap);
}

.gmdocs-search__label {
	flex: 0 0 100%;
	font-size: 0.9em;
	color: var(--gmdocs-muted);
}

.gmdocs-search__input {
	flex: 1 1 16rem;
	min-width: 0;
	padding: 0.45rem 0.6rem;
	border: 1px solid var(--gmdocs-border);
	border-radius: 3px;
	background: transparent;
	color: inherit;
	font: inherit;
}

.gmdocs-search__status {
	flex: 0 0 100%;
	font-size: 0.85em;
	color: var(--gmdocs-muted);
}

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

.gmdocs-title {
	margin: 0 0 var(--gmdocs-gap);
	font-size: 1.25em;
}

/* Folders — accordion ---------------------------------------------------- */

.gmdocs-folder {
	border-bottom: 1px solid var(--gmdocs-border);
}

.gmdocs-folder__summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	padding: 0.7rem 0.4rem;
	cursor: pointer;
	list-style: none;
	font-weight: 600;
}

/* The default disclosure triangle is replaced with our own marker so it can
   sit on the correct side and pick up the accent colour. */
.gmdocs-folder__summary::-webkit-details-marker {
	display: none;
}

.gmdocs-folder__summary::after {
	content: "";
	width: 0.5em;
	height: 0.5em;
	margin-left: auto;
	border-right: 2px solid var(--gmdocs-accent);
	border-bottom: 2px solid var(--gmdocs-accent);
	transform: rotate(45deg);
	transition: transform 0.15s ease;
}

.gmdocs-folder[open] > .gmdocs-folder__summary::after {
	transform: rotate(-135deg);
}

.gmdocs-folder__summary:hover,
.gmdocs-folder__summary:focus-visible {
	background: var(--gmdocs-row-hover);
}

.gmdocs-folder__icon,
.gmdocs-file__icon {
	display: inline-flex;
	align-items: center;
	color: var(--gmdocs-accent);
	flex: 0 0 auto;
}

.gmdocs-file__icon {
	margin-right: 0.45rem;
	vertical-align: -0.2em;
}

.gmdocs-folder__count {
	color: var(--gmdocs-muted);
	font-size: 0.85em;
	font-weight: 400;
}

.gmdocs-folder__panel {
	padding: 0 0 0.75rem 1.6rem;
}

.gmdocs-folder__children {
	margin-top: 0.25rem;
}

.gmdocs-tree__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.gmdocs-tree__list .gmdocs-tree__list {
	margin-left: 1.25rem;
	border-left: 1px solid var(--gmdocs-border);
	padding-left: 0.75rem;
}

/* Table ------------------------------------------------------------------ */

/* Wide tables scroll inside their own container so the page body never
   scrolls horizontally. */
.gmdocs-tablewrap {
	overflow-x: auto;
	max-width: 100%;
	-webkit-overflow-scrolling: touch;
}

.gmdocs-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95em;
}

.gmdocs-table th,
.gmdocs-table td {
	padding: 0.6rem 0.5rem;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--gmdocs-border);
}

.gmdocs-table thead th {
	white-space: nowrap;
	font-weight: 600;
}

.gmdocs-row:hover {
	background: var(--gmdocs-row-hover);
}

.gmdocs-cell--size,
.gmdocs-cell--downloads {
	white-space: nowrap;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.gmdocs-cell--type,
.gmdocs-cell--version,
.gmdocs-cell--date {
	white-space: nowrap;
	color: var(--gmdocs-muted);
}

.gmdocs-sort {
	text-decoration: none;
}

.gmdocs-sort.is-gmdocs-sorted::after {
	content: "\2195";
	margin-left: 0.35rem;
	font-size: 0.85em;
}

.gmdocs-row[hidden] {
	display: none;
}

/* Single document -------------------------------------------------------- */

.gmdocs-single__filemeta {
	margin-left: 0.5rem;
	color: var(--gmdocs-muted);
	font-size: 0.9em;
}

.gmdocs-versions {
	margin-top: var(--gmdocs-gap);
	border-top: 1px solid var(--gmdocs-border);
	padding-top: 0.75rem;
}

.gmdocs-versions__summary {
	cursor: pointer;
	font-weight: 600;
}

/* Pagination ------------------------------------------------------------- */

.gmdocs-pagination__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: var(--gmdocs-gap) 0 0;
	padding: 0;
	list-style: none;
}

.gmdocs-pagination__item a,
.gmdocs-pagination__item span {
	display: inline-block;
	padding: 0.35rem 0.6rem;
	border: 1px solid var(--gmdocs-border);
	border-radius: 3px;
	text-decoration: none;
}

.gmdocs-empty,
.gmdocs-notice {
	padding: 0.75rem 0;
	color: var(--gmdocs-muted);
}

@media (prefers-reduced-motion: reduce) {
	.gmdocs-root * {
		transition: none !important; /* Overrides theme transitions we do not own. */
		animation: none !important;
	}
}
