/**
 * Site Text — document preview.
 *
 * A document row used to offer one thing: Download. Reading a brochure meant
 * putting a copy on your disk first, every time. These styles add a Preview
 * control beside it and the panel that shows the file in place.
 *
 * The accent is a custom property so a second site can restyle the pair without
 * touching this file: set --stx-doc-accent on the row (or on :root).
 */

.site-text-doc-actions {
	display: flex;
	align-items: stretch;
	gap: 0.5rem;
	flex: none;
}

.site-text-doc-view {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	font-family: "Lexend", system-ui, sans-serif;
	font-weight: 500;
	font-size: 0.9rem;
	line-height: 1.2;
	text-decoration: none;
	padding: 0.5rem 1.05rem;
	border: 1.5px solid var( --stx-doc-accent, #008088 );
	border-radius: 7px;
	color: var( --stx-doc-accent, #008088 );
	background: transparent;
	transition: background 180ms ease, color 180ms ease;
}

.site-text-doc-view:hover,
.site-text-doc-view:focus-visible {
	background: var( --stx-doc-accent, #008088 );
	color: #fff;
}

/* Filled, this button is the twin of Download beside it — so a keyboard user gets
   a ring as well, or the two look identical the moment focus lands here. */
.site-text-doc-view:focus-visible {
	outline: 2px solid #0f3d44;
	outline-offset: 2px;
}

/* On a narrow screen the row's own flex layout squeezes both buttons to nothing.
   Stack instead, and let the pair fill the width so they stay tappable. */
@media ( max-width: 600px ) {
	.suryon-download-row {
		flex-wrap: wrap;
	}

	.site-text-doc-actions {
		width: 100%;
	}

	.site-text-doc-actions > * {
		flex: 1 1 0;
	}
}

/* ------------------------------------------------------------------ the panel */

.site-text-doc-modal[hidden] {
	display: none;
}

.site-text-doc-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp( 0px, 3vw, 32px );
}

.site-text-doc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 15, 61, 68, 0.62 );
}

.site-text-doc-modal__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min( 1040px, 100% );
	height: min( 92vh, 100% );
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 24px 70px rgba( 15, 61, 68, 0.34 );
}

.site-text-doc-modal__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.75rem 0.9rem 0.75rem 1.15rem;
	background: #0f3d44;
	color: #fff;
	flex: none;
}

.site-text-doc-modal__title {
	margin: 0;
	font-family: "Lexend", system-ui, sans-serif;
	font-size: 1.02rem;
	font-weight: 500;
	color: #fff;
	line-height: 1.3;
	/* A long document name must not push the close button off the bar. */
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.site-text-doc-modal__acts {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex: none;
}

.site-text-doc-modal__link,
.site-text-doc-modal__dl {
	font-family: "Lexend", system-ui, sans-serif;
	font-size: 0.84rem;
	font-weight: 500;
	text-decoration: none;
	border-radius: 6px;
	padding: 0.4rem 0.85rem;
	white-space: nowrap;
	transition: background 160ms ease;
}

.site-text-doc-modal__link {
	color: #cfe6e8;
	border: 1px solid rgba( 255, 255, 255, 0.34 );
}

.site-text-doc-modal__link:hover,
.site-text-doc-modal__link:focus {
	color: #fff;
	background: rgba( 255, 255, 255, 0.14 );
}

.site-text-doc-modal__dl {
	color: #fff;
	background: #008088;
}

.site-text-doc-modal__dl:hover,
.site-text-doc-modal__dl:focus {
	background: #00a0aa;
	color: #fff;
}

.site-text-doc-modal__x {
	appearance: none;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 1.6rem;
	line-height: 1;
	padding: 0.1rem 0.5rem 0.3rem;
	border-radius: 6px;
	cursor: pointer;
}

.site-text-doc-modal__x:hover,
.site-text-doc-modal__x:focus {
	background: rgba( 255, 255, 255, 0.16 );
}

.site-text-doc-modal__body {
	flex: 1 1 auto;
	min-height: 0;
	background: #f1f4f5;
	display: flex;
	align-items: center;
	justify-content: center;
}

.site-text-doc-modal__body iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.site-text-doc-modal__body img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	display: block;
}

.site-text-doc-modal__wait {
	font-family: "Lexend", system-ui, sans-serif;
	font-size: 0.95rem;
	color: #5c6470;
}

/* Hidden while the panel is open, so the page behind cannot be scrolled away. */
body.site-text-doc-open {
	overflow: hidden;
}

@media ( max-width: 600px ) {
	.site-text-doc-modal {
		padding: 0;
	}

	.site-text-doc-modal__panel {
		height: 100%;
		border-radius: 0;
	}

	.site-text-doc-modal__link {
		display: none; /* the whole panel is already what "new tab" would give. */
	}
}
