/* Salient Dynasty Card — no bundled font: text inherits the site font.
   A per-part "font from site" (H1-H6 / P) is applied by dyc.js. */

/* The wrapper is the container the layout reacts to (the column the card sits in). */
.dyc-wrap {
	container-type: inline-size;
	width: 100%;
}

.dyc-wrap *,
.dyc-wrap *::before,
.dyc-wrap *::after {
	box-sizing: border-box;
}

.dyc-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: 100%;
	padding: var(--dyc-pad, 20px);
	background: var(--dyc-card-bg, #fff);
	border: 1px solid var(--dyc-card-border, #e6e6e6);
	border-radius: var(--dyc-radius, 28px);
	font-family: inherit;
	color: #111;
	text-align: start;
}

.dyc-card[dir="rtl"] {
	direction: rtl;
}

.dyc-card[dir="ltr"] {
	direction: ltr;
}

.dyc-card a {
	color: inherit;
	text-decoration: none;
	box-shadow: none;
	border: 0;
}

/* Reset theme margins on every text part */
.dyc-card .dyc-badge,
.dyc-card .dyc-title,
.dyc-card .dyc-summary,
.dyc-card .dyc-tab-label,
.dyc-card .dyc-count,
.dyc-card .dyc-king-name,
.dyc-card .dyc-king-years {
	margin: 0;
	padding: 0;
	letter-spacing: normal;
	text-transform: none;
}

/* ------------------------------------------------------------------
 * Top: image + text (same layout on desktop and mobile)
 * ------------------------------------------------------------------ */
.dyc-top {
	display: flex;
	align-items: flex-start;
	gap: 24px;
}

.dyc-media {
	flex: none;
	width: var(--dyc-img-w, 260px);
	height: var(--dyc-img-h, 240px);
	background: var(--dyc-img-bg, #f1f1f1);
	border-radius: calc(var(--dyc-radius, 28px) - 8px);
	overflow: hidden;
}

/* Fixed frame: the image never stretches with the text column. */
.dyc-card .dyc-media img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: var(--dyc-fit, cover);
	object-position: center;
}

.dyc-text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.dyc-card .dyc-badge {
	align-self: flex-start;
	padding: 5px 14px;
	font-size: 13px;
	line-height: 1.4;
	color: #444;
	background: var(--dyc-badge-bg, #f3f3f3);
	border-radius: 999px;
}

.dyc-head {
	display: flex;
	flex-direction: column;
	gap: var(--dyc-title-gap, 2px);
}

.dyc-card .dyc-title {
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
	color: #111;
}

.dyc-card .dyc-summary {
	font-size: 14px;
	line-height: 1.8;
	color: #555;
}

.dyc-card .dyc-more {
	margin: 0;
	padding: 0;
	font-weight: 700;
	color: #111;
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
}

/* Whole card is clickable through the dynasty name link */
.dyc-card .dyc-card-link {
	color: inherit;
}

.dyc-card .dyc-card-link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: var(--dyc-radius, 28px);
	cursor: pointer;
}

.dyc-card .dyc-card-link:focus-visible {
	outline: none;
}

.dyc-card .dyc-card-link:focus-visible::after {
	outline: 2px solid var(--dyc-accent, #111);
	outline-offset: -2px;
}

/* ------------------------------------------------------------------
 * Kings tab (full width under image + text)
 * ------------------------------------------------------------------ */
.dyc-tab {
	position: relative;
	z-index: 2;
	background: var(--dyc-tab-bg, #f7f7f7);
	border-radius: 18px;
	overflow: hidden;
}

.dyc-card button.dyc-tab-btn {
	appearance: none;
	-webkit-appearance: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 16px 18px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-align: start;
	cursor: pointer;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
}

.dyc-card button.dyc-tab-btn:focus-visible {
	outline: 2px solid var(--dyc-accent, #111);
	outline-offset: -2px;
}

.dyc-tab-main {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.dyc-card .dyc-tab-label {
	font-size: 16px;
	font-weight: 400;
	line-height: 1.5;
	color: #111;
}

.dyc-card .dyc-count {
	padding: 3px 10px;
	font-size: 12px;
	line-height: 1.4;
	color: #444;
	background: var(--dyc-count-bg, #ececec);
	border-radius: 999px;
	white-space: nowrap;
}

/* + / − drawn in CSS so the colors are configurable */
.dyc-toggle {
	position: relative;
	flex: none;
	width: 26px;
	height: 26px;
	background: var(--dyc-plus-bg, #fff);
	border: 1px solid var(--dyc-plus-border, #d6d6d6);
	border-radius: 50%;
}

.dyc-toggle::before,
.dyc-toggle::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 12px;
	height: 2px;
	margin: -1px 0 0 -6px;
	background: var(--dyc-plus, #111);
	border-radius: 2px;
	transition: transform var(--dyc-anim, 450ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.dyc-toggle::after {
	transform: rotate(90deg);
}

.dyc-tab.is-open .dyc-toggle::after {
	transform: rotate(0deg);
}

.dyc-tab.is-open .dyc-toggle::before {
	transform: rotate(180deg);
}

/* Smooth height animation (0fr -> 1fr) */
.dyc-body {
	display: grid;
	grid-template-rows: 0fr;
	visibility: hidden;
	transition: grid-template-rows var(--dyc-anim, 450ms) cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear var(--dyc-anim, 450ms);
}

.dyc-tab.is-open .dyc-body {
	grid-template-rows: 1fr;
	visibility: visible;
	transition-delay: 0s;
}

.dyc-body-inner {
	min-height: 0;
	overflow: hidden;
}

.dyc-body-content {
	padding: 0 12px 12px;
}

.dyc-card ul.dyc-kings {
	display: grid;
	grid-template-columns: repeat(var(--dyc-cols, 3), minmax(0, 1fr));
	gap: 1px;
	margin: 0;
	padding: 0;
	list-style: none;
	background: var(--dyc-king-line, #ececec);
	border: 1px solid var(--dyc-king-line, #ececec);
	border-radius: 14px;
	overflow: hidden;
}

.dyc-card ul.dyc-kings > li {
	margin: 0;
	padding: 0;
	list-style: none;
	background: var(--dyc-king-bg, #fff);
	min-width: 0;
}

.dyc-card ul.dyc-kings > li::marker {
	content: none;
}

.dyc-card ul.dyc-kings > li.is-fill {
	grid-column: span var(--dyc-span, 1);
}

.dyc-card .dyc-king {
	display: flex;
	align-items: center;
	gap: 12px;
	height: 100%;
	min-height: 44px;
	padding: 10px 14px;
	color: inherit;
}

.dyc-card a.dyc-king {
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.dyc-card a.dyc-king:hover {
	background: rgba(0, 0, 0, 0.03);
}

.dyc-card a.dyc-king:focus-visible {
	outline: 2px solid var(--dyc-accent, #111);
	outline-offset: -2px;
}

.dyc-king-num {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	font-size: 12px;
	line-height: 1;
	color: #444;
	background: var(--dyc-num-bg, #f1f1f1);
	border-radius: 50%;
}

.dyc-king-text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.dyc-card .dyc-king-name {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.5;
	color: #111;
}

.dyc-card .dyc-king-years {
	font-size: 12.5px;
	line-height: 1.5;
	color: #6b6b6b;
}

.dyc-chev {
	flex: none;
	color: #8a8a8a;
}

.dyc-card[dir="ltr"] .dyc-chev {
	transform: scaleX(-1);
}

/* ------------------------------------------------------------------
 * Narrow container (mobile): same layout, smaller sizes, one column of kings
 * ------------------------------------------------------------------ */
@container (max-width: 560px) {
	.dyc-card {
		gap: 14px;
		padding: var(--dyc-pad, 14px);
		border-radius: var(--dyc-radius, 24px);
	}

	.dyc-top {
		gap: 12px;
	}

	.dyc-media {
		width: var(--dyc-img-w-m, 110px);
		height: var(--dyc-img-h-m, 120px);
		border-radius: calc(var(--dyc-radius, 24px) - 8px);
	}

	.dyc-card .dyc-card-link::after {
		border-radius: var(--dyc-radius, 24px);
	}

	.dyc-card .dyc-badge {
		padding: 4px 12px;
		font-size: 12px;
	}

	.dyc-card .dyc-title {
		font-size: 20px;
	}

	.dyc-card .dyc-summary {
		font-size: 13px;
	}

	.dyc-tab {
		border-radius: 16px;
	}

	.dyc-card button.dyc-tab-btn {
		padding: 14px;
	}

	.dyc-card .dyc-tab-label {
		font-size: 14px;
	}

	.dyc-card .dyc-count {
		padding: 3px 9px;
		font-size: 11px;
	}

	.dyc-toggle {
		width: 24px;
		height: 24px;
	}

	.dyc-body-content {
		padding: 0 8px 8px;
	}

	.dyc-card ul.dyc-kings {
		grid-template-columns: minmax(0, 1fr);
		border-radius: 12px;
	}

	.dyc-card ul.dyc-kings > li.is-fill {
		grid-column: auto;
	}

	.dyc-card .dyc-king {
		gap: 10px;
		padding: 9px 12px;
	}

	.dyc-king-num {
		width: 22px;
		height: 22px;
		font-size: 11px;
	}

	.dyc-card .dyc-king-name {
		font-size: 13px;
	}

	.dyc-card .dyc-king-years {
		font-size: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dyc-body,
	.dyc-toggle::before,
	.dyc-toggle::after {
		transition: none;
	}
}
