/* [satm_videos] — video/podcast card grid.
   Toolbar styles come from resources.css (.satm-rr__*). */

.satm-vg__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
	gap: 20px;
}

/* Fixed column counts: [satm_videos columns="2|3|4"] */
.satm-vg__list--cols-2 { grid-template-columns: repeat(2, 1fr); }
.satm-vg__list--cols-3 { grid-template-columns: repeat(3, 1fr); }
.satm-vg__list--cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Horizontal rows: [satm_videos layout="list"] */
.satm-vg__list--rows {
	grid-template-columns: 1fr;
	gap: 16px;
}

.satm-vg__list--rows .satm-vg__card {
	flex-direction: row;
}

/* In rows the cover stretches to the card's full height. */
.satm-vg__list--rows .satm-vg__media {
	flex: 0 0 300px;
	aspect-ratio: auto;
	min-height: 170px;
}

.satm-vg__list--rows .satm-vg__desc {
	-webkit-line-clamp: 4;
}

.satm-vg__list--rows .satm-vg__body {
	flex: 1;
}

.satm-vg__card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--satm-border);
	border-radius: var(--satm-radius);
	box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
	transition: box-shadow 0.15s ease;
}

.satm-vg__card:hover {
	box-shadow: 0 4px 12px rgba(16, 24, 40, 0.1);
}

.satm-vg__card.is-hidden {
	display: none;
}

/* ---------- Media / thumbnail ---------- */

.satm-vg__media {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #0f1722;
}

.satm-vg .satm-vg__play {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	background: none;
	border: none;
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
}

.satm-vg__thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.satm-vg__thumb--placeholder {
	background: linear-gradient(135deg, #24344d, #0f1722);
}

.satm-vg__play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 54px;
	height: 54px;
	transform: translate(-50%, -50%);
	background: rgba(15, 23, 34, 0.72);
	border-radius: 50%;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.satm-vg__play-icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 55%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 10px 0 10px 16px;
	border-color: transparent transparent transparent #fff;
}

/* External links get an arrow instead of a play triangle. */
.satm-vg__play-icon--link::after {
	content: "↗";
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -52%);
	border: none;
	color: #fff;
	font-size: 24px;
	font-weight: 700;
	line-height: 1;
}

.satm-vg .satm-vg__play:hover .satm-vg__play-icon,
.satm-vg .satm-vg__play:focus .satm-vg__play-icon {
	background: var(--satm-accent);
	transform: translate(-50%, -50%) scale(1.08);
}

/* Once playing, the media box holds an iframe / video / audio element. */
.satm-vg__media iframe,
.satm-vg__media video {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.satm-vg__media audio {
	display: block;
	width: calc(100% - 24px);
	margin: 0 12px;
	position: absolute;
	bottom: 12px;
}

/* ---------- Card body ---------- */

.satm-vg__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 14px 16px 16px;
}

.satm-vg__body .satm-rr__card-head {
	margin-bottom: 0;
}

.satm-vg__title {
	margin: 0;
	font-size: 17px;
	line-height: 1.35;
}

.satm-vg__title a {
	text-decoration: none;
}

.satm-vg__desc {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var(--satm-muted);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
}

.satm-vg__desc p,
.satm-vg__desc ul,
.satm-vg__desc ol {
	margin: 0 0 8px;
}

.satm-vg__desc > :last-child {
	margin-bottom: 0;
}

/* Card footer: "More info" + source link on one row, pinned to the
   bottom so actions line up across cards of the same row. */
.satm-vg__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	align-items: center;
	justify-content: space-between;
	margin-top: auto;
	padding-top: 8px;
}

/* In rows there is room to spare — keep the actions together. */
.satm-vg__list--rows .satm-vg__actions {
	justify-content: flex-start;
	gap: 8px 20px;
}

/* Primary action: opens the detail modal. Styled as a small button so it
   reads differently from the outbound text link next to it. */
.satm-vg .satm-vg__more {
	margin: 0;
	padding: 6px 14px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0;
	text-transform: none;
	text-decoration: none;
	color: var(--satm-accent);
	background: #fff;
	border: 1px solid var(--satm-accent);
	border-radius: var(--satm-radius);
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.satm-vg .satm-vg__more:hover,
.satm-vg .satm-vg__more:focus {
	color: #fff;
	background: var(--satm-accent);
}

/* ---------- Badges ---------- */

.satm-vg__badge--video {
	background: #eef4fb;
	border-color: #c9dcf2;
	color: #1d4e89;
}

.satm-vg__badge--podcast {
	background: #f3eefb;
	border-color: #d9c9f2;
	color: #5b2d91;
}

/* ---------- View toggle (grid/list) ---------- */

/* The toggle sits at the far right; when Reset is visible it slides in
   just before it (Reset carries margin-left:auto from resources.css). */
.satm-vg__view {
	display: flex;
	gap: 4px;
}

.satm-vg .satm-rr__reset[hidden] ~ .satm-vg__view {
	margin-left: auto;
}

.satm-vg .satm-vg__view-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	color: var(--satm-muted);
	background: #fff;
	border: 1px solid var(--satm-border);
	border-radius: var(--satm-radius);
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.satm-vg .satm-vg__view-btn:hover,
.satm-vg .satm-vg__view-btn:focus {
	color: var(--satm-accent);
	background: #fff;
}

.satm-vg .satm-vg__view-btn.is-active {
	color: #fff;
	background: var(--satm-accent);
	border-color: var(--satm-accent);
}

/* ---------- Source link ---------- */

.satm-vg__source-link {
	font-size: 13px;
	font-weight: 600;
	color: var(--satm-muted);
	text-decoration: underline;
}

.satm-vg__source-link:hover,
.satm-vg__source-link:focus {
	color: var(--satm-accent);
}

/* ---------- Modal ---------- */

.satm-vg-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.satm-vg-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 14, 20, 0.82);
	cursor: pointer;
}

.satm-vg-modal__dialog {
	position: relative;
	width: min(880px, 100%);
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	background: #fff;
	border-radius: var(--satm-radius, 4px);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.satm-vg-modal__close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	width: 36px;
	height: 36px;
	padding: 0;
	font-size: 24px;
	line-height: 1;
	color: #fff;
	background: rgba(10, 14, 20, 0.65);
	border: none;
	border-radius: 50%;
	cursor: pointer;
}

.satm-vg-modal__close:hover,
.satm-vg-modal__close:focus {
	background: var(--satm-accent, #1a7f83);
	color: #fff;
}

.satm-vg-modal__media {
	aspect-ratio: 16 / 9;
	background: #0f1722;
}

.satm-vg-modal__media--audio {
	aspect-ratio: auto;
	padding: 28px 20px;
}

.satm-vg-modal__media iframe,
.satm-vg-modal__media video {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Cover image shown when the entry has no player (external pages). */
.satm-vg-modal__media .satm-vg__thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.satm-vg-modal__media .satm-vg__thumb--placeholder {
	background: linear-gradient(135deg, #24344d, #0f1722);
}

.satm-vg-modal__media audio {
	display: block;
	width: 100%;
}

.satm-vg-modal__info {
	padding: 18px 22px 22px;
}

.satm-vg-modal__title {
	margin: 0 0 6px;
	font-size: 20px;
	line-height: 1.3;
}

.satm-vg-modal__meta {
	margin: 0 0 12px;
	font-size: 14px;
	font-weight: 600;
	color: var(--satm-muted, #6b7280);
}

/* The modal hangs off <body>, outside the theme's content wrappers, so its
   typography must be self-contained — the theme's p/a/ul rules never reach it. */
.satm-vg-modal__desc {
	margin: 0 0 12px;
	font-size: 15px;
	line-height: 1.6;
	color: #2c3338;
}

.satm-vg-modal__desc p {
	margin: 0 0 12px;
	font-size: inherit;
	line-height: inherit;
}

.satm-vg-modal__desc a {
	color: var(--satm-accent, #1a7f83);
	text-decoration: underline;
}

.satm-vg-modal__desc strong,
.satm-vg-modal__desc b {
	font-weight: 700;
}

.satm-vg-modal__desc em,
.satm-vg-modal__desc i {
	font-style: italic;
}

.satm-vg-modal__desc ul,
.satm-vg-modal__desc ol {
	margin: 0 0 12px;
	padding-left: 22px;
}

.satm-vg-modal__desc ul {
	list-style: disc;
}

.satm-vg-modal__desc ol {
	list-style: decimal;
}

.satm-vg-modal__desc li {
	margin-bottom: 4px;
}

.satm-vg-modal__desc blockquote {
	margin: 0 0 12px;
	padding: 6px 0 6px 14px;
	border-left: 3px solid var(--satm-border, #e2e5ea);
	color: var(--satm-muted, #6b7280);
}

.satm-vg-modal__desc img {
	max-width: 100%;
	height: auto;
}

.satm-vg-modal__desc > :last-child {
	margin-bottom: 0;
}

.satm-vg-modal__desc:empty,
.satm-vg-modal__meta:empty {
	display: none;
}

.satm-vg-modal__link {
	font-size: 14px;
	font-weight: 600;
	color: var(--satm-accent, #1a7f83);
	text-decoration: underline;
}

/* ---------- Mobile ---------- */

@media (max-width: 700px) {
	.satm-vg__list--rows .satm-vg__card {
		flex-direction: column;
	}

	.satm-vg__list--rows .satm-vg__media {
		flex: none;
	}
}

@media (max-width: 600px) {
	.satm-vg__list,
	.satm-vg__list--cols-2,
	.satm-vg__list--cols-3,
	.satm-vg__list--cols-4 {
		grid-template-columns: 1fr;
	}

	.satm-vg-modal {
		padding: 10px;
	}
}
