/*
 * Rechtliche Situation Österreich (Legal AT) widget — replaces the old page's sidebar
 * navigation + custom search JS with two views: a "Kurzfassung" (TL;DR, shown by
 * default) and a "Detailansicht" using vertical interactive tabs (chapter list on the
 * left, sticky; content slides in on the right) — a more editorial, higher-end pattern
 * for long-form legal text than a plain accordion, closer to the source's own sidebar-
 * navigated structure but reimplemented cleanly in the plugin's card/pill language.
 */

.ac-legal {
	font-family: 'Amiko', sans-serif;
}

.ac-legal-view-toggle {
	display: flex;
	gap: 10px;
	margin-bottom: 35px;
	flex-wrap: wrap;
}

.ac-legal-view-btn,
.ac-legal-view-btn:link,
.ac-legal-view-btn:visited {
	appearance: none;
	outline: none;
	cursor: pointer;
	padding: 12px 28px;
	border-radius: 50px;
	border: 2px solid var( --ac-accent, #2e6741 );
	background-color: transparent !important;
	color: var( --ac-accent, #2e6741 ) !important;
	font-family: 'Montserrat', sans-serif;
	font-weight: 700;
	font-size: 0.95rem;
	transition: background-color 0.25s, color 0.25s;
}

.ac-legal-view-btn:hover,
.ac-legal-view-btn:focus {
	background-color: rgba( 46, 103, 65, 0.08 ) !important;
}

.ac-legal-view-btn.ac-active,
.ac-legal-view-btn.ac-active:hover,
.ac-legal-view-btn.ac-active:focus {
	background-color: var( --ac-accent, #2e6741 ) !important;
	color: #fff !important;
}

.ac-legal-view {
	display: none;
}

.ac-legal-view.ac-active {
	display: block;
	animation: ac-legal-fade-in 0.35s ease-out;
}

@keyframes ac-legal-fade-in {
	from {
		opacity: 0;
		transform: translateY( 12px );
	}
	to {
		opacity: 1;
		transform: translateY( 0 );
	}
}

/* Kurzfassung (TL;DR) */

.ac-legal-tldr-intro-grid {
	margin-bottom: 30px;
}

/* Font-size/weight/color come from the shared .ac-heading class (see ac-fonts.css). */
.ac-legal-tldr-heading {
	margin: 0 0 16px;
	padding-bottom: 14px;
	border-bottom: 3px solid var( --ac-accent, #2e6741 );
}

.ac-legal-tldr-intro {
	font-size: 1.05rem;
	line-height: 1.7;
	color: #555;
	margin: 0;
}

.ac-legal-tldr-block {
	background-color: #fff;
	border: 1px solid #eee;
	border-left: 4px solid var( --ac-accent, #2e6741 );
	border-radius: 0 10px 10px 0;
	padding: 22px 25px;
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.05 );
}

.ac-legal-tldr-block + .ac-legal-tldr-block {
	margin-top: 18px;
}

.ac-legal-tldr-block-title {
	font-family: 'Montserrat', sans-serif;
	font-size: 1.05rem;
	font-weight: 700;
	color: #111;
	margin: 0 0 12px;
}

.ac-legal-tldr-block-text p {
	font-size: 0.95rem;
	line-height: 1.7;
	color: #333;
	margin: 0 0 12px;
}

.ac-legal-tldr-block-text p:last-child {
	margin-bottom: 0;
}

.ac-legal-tldr-block-text ul {
	margin: 0;
	padding-left: 20px;
}

.ac-legal-tldr-block-text li {
	font-size: 0.95rem;
	line-height: 1.7;
	color: #333;
	margin-bottom: 10px;
}

.ac-legal-tldr-block-text li:last-child {
	margin-bottom: 0;
}

.ac-legal-tldr-block-text strong {
	font-weight: 700;
	color: #111;
}

.ac-legal-tldr-footer {
	margin-top: 30px;
	padding-top: 22px;
	border-top: 1px solid #eee;
	font-size: 0.85rem;
	line-height: 1.7;
	color: #777;
}

.ac-legal-tldr-footer strong {
	color: #444;
}

/* Detailansicht — vertical tabs */

.ac-legal-tabs {
	display: grid;
	grid-template-columns: 280px 1fr;
	gap: 40px;
	align-items: start;
}

/*
 * display:contents on desktop makes this wrapper invisible to the grid layout — its
 * children (.ac-legal-tabs-current, .ac-legal-tabs-nav) act as if they were direct grid
 * items, exactly as before this wrapper was introduced. On mobile it becomes a real
 * positioning container instead (see the 780px media query) — needed so the dropdown's
 * top:100% resolves against just the button's height, not the whole .ac-legal-tabs
 * container (which also includes the tall content panel next to it; without this the
 * dropdown opened below the content instead of below the button).
 */
.ac-legal-tabs-nav-wrap {
	display: contents;
}

/* Mobile-only "current chapter" selector — see the 780px media query below. */
.ac-legal-tabs-current {
	display: none;
}

.ac-legal-tabs-nav {
	display: flex;
	flex-direction: column;
	gap: 2px;
	position: sticky;
	top: 20px;
}

.ac-legal-tab-btn,
.ac-legal-tab-btn:link,
.ac-legal-tab-btn:visited {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	appearance: none;
	outline: none;
	cursor: pointer;
	text-align: left;
	padding: 13px 16px;
	border: none;
	border-left: 3px solid transparent;
	border-radius: 0 8px 8px 0;
	background-color: transparent !important;
	color: #444 !important;
	font-family: 'Montserrat', sans-serif;
	font-weight: 600;
	font-size: 0.88rem;
	line-height: 1.3;
	transition: background-color 0.25s, border-color 0.25s, color 0.25s, padding-left 0.25s;
}

/*
 * Flex items default to min-width:auto, which blocks wrapping and forces long content
 * to overflow instead — chapter titles here are full sentences ("I. Strafrechtliche
 * Grundlagen und Tatbestände"), so this must be able to wrap onto multiple lines rather
 * than push past the 280px sidebar column.
 */
.ac-legal-tab-btn-text {
	min-width: 0;
	flex: 1;
	white-space: normal;
	overflow-wrap: break-word;
}

.ac-legal-tab-btn:hover,
.ac-legal-tab-btn:focus {
	background-color: #f7f9fc !important;
	border-left-color: #dde3df;
	padding-left: 20px;
}

.ac-legal-tab-btn.ac-active {
	background-color: rgba( 46, 103, 65, 0.08 ) !important;
	border-left-color: var( --ac-accent, #2e6741 );
	color: var( --ac-accent, #2e6741 ) !important;
	padding-left: 20px;
}

.ac-legal-tab-btn-icon {
	flex-shrink: 0;
	display: inline-flex;
	font-size: 0.65rem;
	line-height: 1;
	opacity: 0;
	transform: translateX( -4px );
	transition: opacity 0.25s, transform 0.25s;
}

.ac-legal-tab-btn.ac-active .ac-legal-tab-btn-icon {
	opacity: 1;
	transform: translateX( 0 );
}

.ac-legal-tab-btn-icon svg {
	width: 1em !important;
	height: 1em !important;
	fill: currentColor !important;
}

.ac-legal-tabs-panels {
	background-color: #fff;
	border: 1px solid #eee;
	border-radius: 12px;
	padding: 32px 36px;
	box-shadow: 0 4px 20px rgba( 0, 0, 0, 0.05 );
	min-height: 260px;
}

.ac-legal-tab-panel {
	display: none;
}

.ac-legal-tab-panel.ac-active {
	display: block;
	animation: ac-legal-fade-in 0.3s ease-out;
}

.ac-legal-tab-panel-title {
	font-family: 'Montserrat', sans-serif;
	font-weight: 800;
	font-size: 1.3rem;
	line-height: 1.25;
	color: #111;
	margin: 0 0 20px;
	padding-bottom: 16px;
	border-bottom: 1px solid #eee;
}

.ac-legal-chapter-content h4 {
	font-family: 'Montserrat', sans-serif;
	font-weight: 700;
	font-size: 1.05rem;
	color: #111;
	margin: 22px 0 12px;
}

.ac-legal-chapter-content h4:first-child {
	margin-top: 0;
}

.ac-legal-chapter-content p {
	font-size: 0.95rem;
	line-height: 1.75;
	color: #333;
	margin: 0 0 15px;
}

.ac-legal-chapter-content ul {
	margin: 0 0 15px;
	padding-left: 20px;
}

.ac-legal-chapter-content li {
	font-size: 0.95rem;
	line-height: 1.7;
	color: #333;
	margin-bottom: 8px;
}

.ac-legal-chapter-content strong {
	font-weight: 700;
	color: #111;
}

/*
 * Stands in for the source's three separate highlight/warning/info callout colors — one
 * consistent, brand-accent style rather than introducing the source's off-brand amber.
 */
.ac-legal-chapter-content blockquote {
	background: linear-gradient( 135deg, #f7f9fc, #eef3f0 );
	border-left: 4px solid var( --ac-accent, #2e6741 );
	border-radius: 0 8px 8px 0;
	padding: 16px 20px;
	margin: 15px 0 20px;
	font-size: 0.92rem;
	line-height: 1.7;
	color: #333;
}

.ac-legal-chapter-content blockquote p {
	margin: 0;
}

@media ( max-width: 780px ) {
	.ac-legal-tabs {
		grid-template-columns: 1fr;
	}

	/* Real positioning container now — see the comment on the base rule above. */
	.ac-legal-tabs-nav-wrap {
		display: block;
		position: relative;
	}

	/*
	 * A horizontally scrollable pill bar was tried here first — it hid most chapters
	 * off-screen with no clear sense of how many there were or what else was available,
	 * which made the whole section hard to get an overview of. This "current chapter"
	 * button + full-list dropdown (same interaction as the Mobile-Nav widget's own
	 * toggle-reveals-menu pattern) keeps every chapter title visible and scannable in one
	 * vertical list the moment it's opened, instead of requiring horizontal scrolling to
	 * discover them.
	 */
	.ac-legal-tabs-current {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		width: 100%;
		appearance: none;
		outline: none;
		cursor: pointer;
		text-align: left;
		background-color: #fff !important;
		border: 2px solid #eee;
		border-radius: 12px;
		padding: 14px 18px;
		margin-bottom: 10px;
		transition: border-color 0.25s;
	}

	.ac-legal-tabs-current:hover,
	.ac-legal-tabs-current:focus {
		border-color: var( --ac-accent, #2e6741 );
	}

	.ac-legal-tabs-current-label {
		display: flex;
		flex-direction: column;
		gap: 3px;
		min-width: 0;
	}

	.ac-legal-tabs-current-eyebrow {
		font-family: 'Montserrat', sans-serif;
		font-weight: 700;
		font-size: 0.68rem;
		text-transform: uppercase;
		letter-spacing: 1.5px;
		color: var( --ac-accent, #2e6741 ) !important;
	}

	.ac-legal-tabs-current-text {
		font-family: 'Montserrat', sans-serif;
		font-weight: 700;
		font-size: 0.95rem;
		line-height: 1.3;
		color: #111 !important;
		white-space: normal;
	}

	.ac-legal-tabs-current-icon {
		flex-shrink: 0;
		display: inline-flex;
		font-size: 0.8rem;
		color: var( --ac-accent, #2e6741 );
		transition: transform 0.25s;
	}

	.ac-legal-tabs-current-icon svg {
		width: 1em !important;
		height: 1em !important;
		fill: currentColor !important;
	}

	.ac-legal-tabs-current[aria-expanded="true"] .ac-legal-tabs-current-icon {
		transform: rotate( 180deg );
	}

	/*
	 * The full chapter list — hidden by default on mobile, opened as a dropdown panel
	 * below the "current chapter" button (see .ac-legal-tabs-current above). Positioned
	 * absolutely so opening it doesn't shove the content panel down the page.
	 */
	.ac-legal-tabs-nav {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 10;
		background-color: #fff;
		border: 1px solid #eee;
		border-radius: 12px;
		box-shadow: 0 10px 30px rgba( 0, 0, 0, 0.12 );
		padding: 8px;
		max-height: 60vh;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.ac-legal-tabs-nav.ac-open {
		display: flex;
	}

	.ac-legal-tab-btn,
	.ac-legal-tab-btn:link,
	.ac-legal-tab-btn:visited {
		border-radius: 8px;
	}

	.ac-legal-tabs-panels {
		padding: 24px 20px;
	}
}

@media ( max-width: 600px ) {
	.ac-legal-view-btn {
		flex: 1;
		text-align: center;
		padding: 12px 16px;
	}
}
