.fw-documents {
}

.fw-documents__search-container {
	gap: 30px;
	justify-content: space-between;
}

/* @media (min-width: 781px) {
	.fw-documents:not(:has(.fw-documents__filters)) .fw-documents__search-container {
		display: flex;
	}
} */

@media (min-width: 1024px) {
	.fw-documents__search-container {
		display: flex;
	}

	.fw-documents:has(.fw-documents__filters) .fw-documents__search-container:before {
		content: '';
		flex: 0 0 250px;
	}
}


.fw-documents__results {
	justify-self: flex-start;
	line-height: 42px;
	margin-right: auto;
}

.fw-documents__results strong {
	color: inherit;
	font-weight: inherit;
}

.fw-documents__link {
	display: inline-block;
	font-size: var(--wp--preset--font-size--small);
	margin-left: 1em;
	text-decoration: none;
}

.fw-documents__results-s--hidden {
	display: none;
}

.fw-documents__search {
	max-width: 385px;
	position: relative;
	justify-self: flex-end;
	width: 100%;
}

.fw-documents__search-label {
	background-color: #FFFFFF;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill='%2302203F' d='M12.938 7.313a5.625 5.625 0 1 0-11.25 0 5.625 5.625 0 0 0 11.25 0Zm-1.087 5.734a7.277 7.277 0 0 1-4.539 1.578A7.311 7.311 0 0 1 0 7.312 7.311 7.311 0 0 1 7.313 0a7.311 7.311 0 0 1 7.312 7.313c0 1.715-.59 3.294-1.579 4.538l4.36 4.36.598.597L16.807 18l-.598-.598-4.359-4.359v.004Z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h18v18H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
	background-position: center;
	background-repeat: no-repeat;
	background-size: 18px 18px;
	border-left: 1px solid var( --wp--preset--color--contrast );
	border-bottom-right-radius: 5px;
	border-top-right-radius: 5px;
	right: 1px;
	position: absolute;
	height: 40px;
	overflow: hidden;
	text-indent: 110%;
	text-wrap: nowrap;
	top: 1px;
	width: 40px;
}

.fw-documents__search-input::placeholder {
	color: inherit;
	opacity: .5;
}

.fw-documents__search-input {
	-webkit-appearance: none;
	-moz-appearance: none;
	-o-appearance: none;
	appearance: none;
	background-color: #FFFFFF;
	border: 1px solid var( --wp--preset--color--contrast );
	border-radius: 5px;
	display: block;
	height: 42px;
	padding: 0 .5em;
	padding-top: 4px;
	width: 100%;
}

.fw-documents__hidden-filter {
	display: none !important;
}

.fw-documents__container {
	display: flex;
	flex-direction: column;
	gap: 30px;
}

@media (min-width: 1024px) {
	.fw-documents__container {
		flex-direction: row;
	}
}

.fw-documents__filters {
	font-size: var(--wp--preset--font-size--small);
	/* padding-top: calc( var(--wp--preset--font-size--medium) * var(--wp--custom--typography--root--line-height) + var(--wp--style--block-gap) * 2 ); */
}

.fw-documents__filter > .fw-documents__filter:first-of-type {
	margin-block-start: 1em !important;
}

.fw-documents__filter .fw-documents__filter {
	padding-left: 1em;
}

@media (min-width: 1024px) {
	.fw-documents__filters {
		flex: 0 0 250px;
	}
}

.fw-documents__filter {
	margin-bottom: 1em;
}

.fw-documents__filter input[type="checkbox"] {
	height: 0;
}

.fw-documents__filter input {
	height: 0;
	visibility: hidden;
	width: 0;
}

.fw-documents__filter label {
	position: relative;
	padding-left: 26px;

	display: block;
	text-indent: -7px;
}

.fw-documents__filter label:before {
	content: '';
	text-indent: -9999px;
	width: 18px;
	height: 12px;
	background: #CFCFCF;
	border: 1px solid #CFCFCF;
	display: block;
	border-radius: 100px;
	position: absolute;
	left: 0;
	top: 2px;
}

.fw-documents__filter label:has(:checked):before {
	background: #A3A3A3;
	border: 1px solid #A3A3A3;
}

.fw-documents__filter label:after {
	content: '';
	position: absolute;
	border: 1px solid #B3B3B3;
	top: 2px;
	left: 0;
	width: 12px;
	height: 12px;
	margin: 0;
	background: #fff;
	border-radius: 100px;
	transition: left 0.25s ease;
}

.fw-documents__filter label:has(:checked):after {
	left: 6px;
}

.fw-documents__list-container {
	flex: 0 0 calc( 100% - 250px - 30px );
	/* margin-top: var(--wp--style--block-gap); */
}

.fw-documents__list-container:only-child {
	flex: 0 0 100%;
}

.fw-documents__list {
	/* margin-top: var(--wp--style--block-gap); */
}

.fw-documents--loading .fw-documents__list:after {
	content: 'Loading...';
}

.fw-documents--loading .fw-documents__results:before {
	content: 'Loading ';
}

.fw-documents--loading .fw-documents__results strong {
	display: none;
}

.fw-documents--loading .fw-documents__results-prefix {
	display: none;
}

.fw-documents__item-container .fw-documents__items::-webkit-details-marker {
	display: none;
}

.fw-documents__items {
	line-height: 1;
}

.fw-documents__item-container .fw-documents__items {
	list-style-type: none;
}

.fw-documents__headings:before,
.fw-documents__items:before {
	content: '';
	width: 16px;
	height: 18px;
	flex: 0 0 16px;
}

.fw-documents__item-container > .fw-documents__items {
	padding-left: 6px;
}

.fw-documents__item-container > .fw-documents__items:before {
	align-self: flex-start;
	/* Painted as a mask filled with currentColor rather than a background
	   image, so the expand/collapse icon follows the block's text colour. The
	   colour of a data-URI background is baked into the SVG — black here — and
	   cannot respond to a dark block background. */
	background-color: currentColor;
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='18' fill='none'%3E%3Cpath fill='%23000' d='M2.286 15.75a1.133 1.133 0 0 1-1.143-1.125V3.375c0-.622.51-1.125 1.143-1.125h11.428c.632 0 1.143.503 1.143 1.125v11.25c0 .622-.51 1.125-1.143 1.125H2.286ZM0 14.625c0 1.241 1.025 2.25 2.286 2.25h11.428c1.261 0 2.286-1.009 2.286-2.25V3.375c0-1.241-1.025-2.25-2.286-2.25H2.286C1.025 1.125 0 2.134 0 3.375v11.25Zm7.429-9v2.813H4.57A.569.569 0 0 0 4 9c0 .31.257.563.571.563H7.43v2.812c0 .31.257.563.571.563a.569.569 0 0 0 .571-.563V9.562h2.858A.569.569 0 0 0 12 9a.569.569 0 0 0-.571-.563H8.57V5.626A.569.569 0 0 0 8 5.062a.569.569 0 0 0-.571.563Z'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='18' fill='none'%3E%3Cpath fill='%23000' d='M2.286 15.75a1.133 1.133 0 0 1-1.143-1.125V3.375c0-.622.51-1.125 1.143-1.125h11.428c.632 0 1.143.503 1.143 1.125v11.25c0 .622-.51 1.125-1.143 1.125H2.286ZM0 14.625c0 1.241 1.025 2.25 2.286 2.25h11.428c1.261 0 2.286-1.009 2.286-2.25V3.375c0-1.241-1.025-2.25-2.286-2.25H2.286C1.025 1.125 0 2.134 0 3.375v11.25Zm7.429-9v2.813H4.57A.569.569 0 0 0 4 9c0 .31.257.563.571.563H7.43v2.812c0 .31.257.563.571.563a.569.569 0 0 0 .571-.563V9.562h2.858A.569.569 0 0 0 12 9a.569.569 0 0 0-.571-.563H8.57V5.626A.569.569 0 0 0 8 5.062a.569.569 0 0 0-.571.563Z'/%3E%3C/svg%3E");
	mask-repeat: no-repeat;
	-webkit-mask-repeat: no-repeat;
	mask-size: contain;
	-webkit-mask-size: contain;
	mask-position: center;
	-webkit-mask-position: center;
	margin-top: -2px;
}

.fw-documents__item-container[open] > .fw-documents__items:before {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3E%3Cpath fill='%23000' d='M2.286 14.75a1.133 1.133 0 0 1-1.143-1.125V2.375c0-.622.51-1.125 1.143-1.125h11.428c.632 0 1.143.503 1.143 1.125v11.25c0 .622-.51 1.125-1.143 1.125H2.286ZM0 13.625c0 1.241 1.025 2.25 2.286 2.25h11.428c1.261 0 2.286-1.009 2.286-2.25V2.375c0-1.241-1.025-2.25-2.286-2.25H2.286C1.025.125 0 1.134 0 2.375v11.25Zm4.571-5.063h6.858A.569.569 0 0 0 12 8a.569.569 0 0 0-.571-.563H4.57A.569.569 0 0 0 4 8c0 .31.257.563.571.563Z'/%3E%3C/svg%3E");
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3E%3Cpath fill='%23000' d='M2.286 14.75a1.133 1.133 0 0 1-1.143-1.125V2.375c0-.622.51-1.125 1.143-1.125h11.428c.632 0 1.143.503 1.143 1.125v11.25c0 .622-.51 1.125-1.143 1.125H2.286ZM0 13.625c0 1.241 1.025 2.25 2.286 2.25h11.428c1.261 0 2.286-1.009 2.286-2.25V2.375c0-1.241-1.025-2.25-2.286-2.25H2.286C1.025.125 0 1.134 0 2.375v11.25Zm4.571-5.063h6.858A.569.569 0 0 0 12 8a.569.569 0 0 0-.571-.563H4.57A.569.569 0 0 0 4 8c0 .31.257.563.571.563Z'/%3E%3C/svg%3E");
}

.fw-documents__item-container > .fw-documents__items:after {
	content: 'Read More';
	display: block;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	margin-right: 4px;
	margin-top: 12px;
	padding-right: 24px;
	line-height: 16px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='18' fill='none'%3E%3Cpath fill='%23D90606' d='M2.286 15.75a1.133 1.133 0 0 1-1.143-1.125V3.375c0-.622.51-1.125 1.143-1.125h11.428c.632 0 1.143.503 1.143 1.125v11.25c0 .622-.51 1.125-1.143 1.125H2.286ZM0 14.625c0 1.241 1.025 2.25 2.286 2.25h11.428c1.261 0 2.286-1.009 2.286-2.25V3.375c0-1.241-1.025-2.25-2.286-2.25H2.286C1.025 1.125 0 2.134 0 3.375v11.25Zm7.429-9v2.813H4.57A.569.569 0 0 0 4 9c0 .31.257.563.571.563H7.43v2.812c0 .31.257.563.571.563a.569.569 0 0 0 .571-.563V9.562h2.858A.569.569 0 0 0 12 9a.569.569 0 0 0-.571-.563H8.57V5.626A.569.569 0 0 0 8 5.062a.569.569 0 0 0-.571.563Z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: 12px 14px;
	background-position: top right;
	height: 1em;
	line-height: 1em;
}

.fw-documents__item-container[open] .fw-documents__items:after {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3E%3Cpath fill='%23000' d='M2.286 14.75a1.133 1.133 0 0 1-1.143-1.125V2.375c0-.622.51-1.125 1.143-1.125h11.428c.632 0 1.143.503 1.143 1.125v11.25c0 .622-.51 1.125-1.143 1.125H2.286ZM0 13.625c0 1.241 1.025 2.25 2.286 2.25h11.428c1.261 0 2.286-1.009 2.286-2.25V2.375c0-1.241-1.025-2.25-2.286-2.25H2.286C1.025.125 0 1.134 0 2.375v11.25Zm4.571-5.063h6.858A.569.569 0 0 0 12 8a.569.569 0 0 0-.571-.563H4.57A.569.569 0 0 0 4 8c0 .31.257.563.571.563Z'/%3E%3C/svg%3E");
}

.fw-documents__headings {
	display: none;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
}

.fw-documents__headings,
.fw-documents__items {
	/* display: flex; */
	gap: 20px;
	padding: 14px 0;
	padding-bottom: 10px;
	/* margin-bottom: 10px; */
}

.fw-documents__cell {
	display: flex;
	font-size: var(--wp--preset--font-size--small);
	text-align: left;
}

.fw-documents__cell:before {
	content: attr(data-label) ": ";
	font-weight: 500;
	flex: 0 0 10ch;
	text-align: left;
}

@media (min-width: 781px) {
	.fw-documents:not(:has(.fw-documents__filters)) .fw-documents__item-container .fw-documents__items:after {
		display: none;
	}
	.fw-documents:not(:has(.fw-documents__filters)) .fw-documents__headings,
	.fw-documents:not(:has(.fw-documents__filters)) .fw-documents__items {
		display: flex;
	}

	.fw-documents:not(:has(.fw-documents__filters)) .fw-documents__cell {
		display: block;
	}

	.fw-documents:not(:has(.fw-documents__filters)) .fw-documents__cell:before {
		display: none;
	}
	.fw-documents__item-container .fw-documents__items:after {
		display: none;
	}
}

@media (min-width: 1024px) {
	.fw-documents__headings,
	.fw-documents__items {
		display: flex;
	}

	.fw-documents__cell {
		display: block;
	}

	.fw-documents__cell:before {
		display: none;
	}
}

.fw-documents__items,
.fw-documents__item-container {
	border-bottom: 1px solid var( --wp--preset--color--primary );
}

/* .fw-documents__list-container--category:not( :has( > .fw-documents__item-container > .fw-documents__details > .fw-documents__list-container > .fw-documents__list  .fw-documents__items ) ) {
	display: none;
} */

.fw-documents__item-container > .fw-documents__items,
.fw-documents__list .fw-documents__list .fw-documents__list .fw-documents__items:last-child,
.fw-documents__list-container--category .fw-documents__list .fw-documents__list-container--category:last-child > .fw-documents__item-container,
.fw-documents__list-container--category .fw-documents__list .fw-documents__items:last-child {
	border-bottom: 0;
}

/* No background is set on the headings or the category rows. Colour for this
   block comes entirely from the editor — per-block, or site-wide via
   Styles > Blocks > Documents — and any value hard-coded here would paint over
   it. Rows stay legible through their border-bottom, weight and letter-casing
   rather than through a fill. */

.fw-documents__details:not( :has( .fw-documents__list:only-child ) ) {
	padding-bottom: 24px;
}

.fw-documents__details.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
	margin-left: 0 !important;
}

/* --- Column widths --------------------------------------------------------
   Title takes a fixed share of the row. Every other column uses `flex: N 1 0`,
   so N is a *weight* rather than a width: the browser divides whatever space
   is left after Title, the 20px gaps and the 16px icon spacer, and hands each
   column a share proportional to N. The weights are the old percentages, so
   the default five-column layout keeps its original proportions.

   The point of the rewrite: nothing here restates any other column's width, so
   hiding a column just returns its space to the remaining ones. The previous
   `calc( 100% - 41% - 17% - 10% - 7% - 20px * 4 - 16px )` on actions hard-coded
   the full set, and went wrong the moment a column was hidden or the block sat
   in a narrow container. */
.fw-documents__heading--name,
.fw-documents__cell--name {
	flex: 0 0 41%;
}

.fw-documents__heading--category,
.fw-documents__cell--category {
	flex: 17 1 0;
}

.fw-documents__heading--modified,
.fw-documents__cell--modified {
	flex: 10 1 0;
}

.fw-documents__heading--format,
.fw-documents__cell--format {
	flex: 7 1 0;
}

.fw-documents__heading--actions,
.fw-documents__cell--actions {
	flex: 25 1 0;
	text-align: center;
}

/* Flex items default to min-width:auto, which refuses to shrink below the
   widest unbreakable word. Without this a long filename or category name
   pushes the row wider than its container instead of wrapping. */
.fw-documents__heading,
.fw-documents__cell {
	min-width: 0;
}

/* Every optional column hidden leaves Title alone on the row, and a 41% Title
   beside 59% of nothing looks broken — let it take the whole row instead.

   `flex: 1 1 0` rather than `flex-basis: 100%`: the row still contains the 16px
   icon spacer and a 20px gap, so a 100% basis with the shrink:0 inherited from
   the shorthand above overflows the container by 36px. Growing from zero fills
   exactly the space that is actually free. */
.fw-documents--hide-category.fw-documents--hide-modified.fw-documents--hide-format.fw-documents--hide-actions
	.fw-documents__heading--name,
.fw-documents--hide-category.fw-documents--hide-modified.fw-documents--hide-format.fw-documents--hide-actions
	.fw-documents__cell--name {
	flex: 1 1 0;
}

/* Both the count and the copy link are hidden.
   The wrapper is deliberately kept in flow rather than display:none, for two
   reasons: documents.js writes into it on every AJAX update without a null
   check, and its margin-right:auto is what pushes the search box to the right
   in the flex layout. Zeroing the line-height drops the 42px it would
   otherwise reserve in the stacked (sub-1024px) layout. */
.fw-documents__results--empty {
	line-height: 0;
}

/* --- Column visibility -----------------------------------------------------
   Toggled per-block from the editor. display:none also removes the cells from
   the accessibility tree, so hidden columns are not announced by screen
   readers. Title has no toggle: it carries the document link, and a row
   without it would be unusable.

   The wrapper class is doubled to reach specificity 0,3,0. The responsive rule
   `.fw-documents:not(:has(.fw-documents__filters)) .fw-documents__cell` also
   scores 0,3,0 because :not(:has()) inherits its argument's specificity, and a
   single-class selector here would lose to it and leave the column visible. */
.fw-documents.fw-documents--hide-category .fw-documents__heading--category,
.fw-documents.fw-documents--hide-category .fw-documents__cell--category,
.fw-documents.fw-documents--hide-modified .fw-documents__heading--modified,
.fw-documents.fw-documents--hide-modified .fw-documents__cell--modified,
.fw-documents.fw-documents--hide-format .fw-documents__heading--format,
.fw-documents.fw-documents--hide-format .fw-documents__cell--format,
.fw-documents.fw-documents--hide-actions .fw-documents__heading--actions,
.fw-documents.fw-documents--hide-actions .fw-documents__cell--actions {
	display: none;
}
