/**
 * Last Topic Cards – stylesheet
 *
 * Every colour and size is a custom property: override them in your own style,
 * e.g.  .topiccards { --tc-accent: #c0392b; --tc-radius: 4px; }
 * Neutral colours use translucent greys so the cards blend into light AND dark styles.
 */

.topiccards {
	--tc-gap: 16px;
	--tc-radius: 10px;
	--tc-padding: 12px;
	--tc-card-bg: transparent;
	--tc-border: rgba(128, 128, 128, .25);
	--tc-shadow: 0 4px 12px rgba(0, 0, 0, .06);
	--tc-shadow-hover: 0 6px 18px rgba(0, 0, 0, .12);
	--tc-muted: rgba(128, 128, 128, 1);
	--tc-button-bg: rgba(128, 128, 128, .12);
	--tc-button-hover: rgba(18, 163, 235, .18);
	--tc-accent: #105289;
	--tc-badge-bg: #bc2a4d;
	--tc-badge-fg: #fff;
	--tc-avatar: 38px;

	margin: 20px 0 24px;
}

.topiccards-top { margin-top: 10px; }

.topiccards .sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ===== Grid ===== */

.tc-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: var(--tc-gap);
	transition: opacity .2s ease;
}

.tc-grid[aria-busy="true"] { opacity: .5; }

/* ===== Card ===== */

.tc-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: var(--tc-padding);
	background: var(--tc-card-bg);
	border: 1px solid var(--tc-border);
	border-radius: var(--tc-radius);
	box-shadow: var(--tc-shadow);
	transition: box-shadow .2s ease, transform .2s ease;
}

.tc-card:hover,
.tc-card:focus-within {
	box-shadow: var(--tc-shadow-hover);
	transform: translateY(-2px);
}

.tc-unread { border-left: 3px solid var(--tc-badge-bg); }

/* ===== Date block ===== */

.tc-top {
	display: flex;
	gap: 12px;
	min-width: 0;
}

.tc-date {
	flex: 0 0 52px;
	align-self: flex-start;
	margin: 0;
	padding: 6px 4px;
	color: #fff;
	text-align: center;
	line-height: 1.15;
	border-radius: 6px;
	box-shadow: 5px 5px 15px -13px #333;
}

.tc-date span { display: block; }
.tc-month { font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.tc-day { font-size: 18px; font-weight: 700; }
.tc-year { font-size: 10px; opacity: .9; }

.tc-main {
	flex: 1 1 auto;
	min-width: 0;
}

/* ===== Title ===== */

.topiccards .tc-title {
	margin: 0 0 8px;
	padding: 0;
	border: 0;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	text-transform: none;
}

.tc-title a {
	display: block;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: inherit;
	text-decoration: none;
}

.tc-title a:hover,
.tc-title a:focus { text-decoration: underline; }

/* ===== Author ===== */

.tc-author {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.tc-avatar {
	display: flex;
	flex: 0 0 var(--tc-avatar);
	align-items: center;
	justify-content: center;
	width: var(--tc-avatar);
	height: var(--tc-avatar);
	overflow: hidden;
	background-color: var(--tc-accent);
	border-radius: 50%;
}

.tc-avatar img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.tc-initial {
	color: #fff;
	font-size: 16px;
	font-weight: 700;
}

.tc-meta {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.tc-username {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font-weight: 600;
	line-height: 1.25;
}

.tc-time {
	color: var(--tc-muted);
	font-size: 11px;
}

/* ===== Forum + excerpt ===== */

.tc-forum {
	display: block;
	margin-top: 12px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
}

.tc-forum .icon { margin-right: 3px; }

.tc-excerpt {
	display: -webkit-box;
	margin: 6px 0 0;
	overflow: hidden;
	color: var(--tc-muted);
	font-size: 13px;
	line-height: 1.45;
	overflow-wrap: anywhere;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	line-clamp: 2;
}

/* ===== Actions ===== */

.tc-actions {
	display: flex;
	gap: 8px;
	margin-top: auto;
	padding-top: 12px;
}

.tc-read-more,
.tc-badge,
.tc-more-btn {
	border-radius: 6px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.tc-read-more {
	flex: 1 1 auto;
	padding: 7px;
	color: inherit;
	background: var(--tc-button-bg);
}

.tc-badge {
	flex: 0 0 auto;
	padding: 7px 10px;
	color: var(--tc-badge-fg) !important;
	background: var(--tc-badge-bg);
	font-size: 11px;
	text-transform: uppercase;
}

.tc-read-more:hover,
.tc-read-more:focus,
.tc-more-btn:hover,
.tc-more-btn:focus { background: var(--tc-button-hover); text-decoration: none; }

.tc-badge:hover,
.tc-badge:focus { filter: brightness(1.1); text-decoration: none; }

/* ===== View more / less ===== */

.tc-more {
	display: flex;
	gap: 10px;
	margin-top: 14px;
}

.tc-more-btn {
	flex: 1 1 0;
	min-width: 0;
	padding: 10px;
	border: 1px solid var(--tc-border);
	color: inherit;
	background: var(--tc-button-bg);
	font-family: inherit;
	font-size: 13px;
	box-shadow: var(--tc-shadow);
}

.tc-more-btn[hidden] { display: none !important; }
.tc-more-btn:disabled { cursor: wait; opacity: .6; }

.tc-error {
	grid-column: 1 / -1;
	margin: 0;
}

/* ===== Dark styles (prosilver_dark & co) ===== */

html.phpbb-dark-mode .topiccards,
.prosilver_dark .topiccards {
	--tc-shadow: 0 4px 12px rgba(0, 0, 0, .35);
	--tc-shadow-hover: 0 6px 18px rgba(0, 0, 0, .5);
	--tc-button-bg: rgba(255, 255, 255, .08);
	--tc-button-hover: rgba(255, 255, 255, .16);
	--tc-accent: #4a6e8c;
}

/* ===== Focus & motion ===== */

.topiccards a:focus-visible,
.tc-more-btn:focus-visible {
	outline: 2px solid var(--tc-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.tc-card,
	.tc-grid { transition: none; }
	.tc-card:hover,
	.tc-card:focus-within { transform: none; }
}

/* ===== Responsive ===== */

@media (max-width: 900px) {
	.tc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
	.topiccards { --tc-gap: 12px; }

	.tc-grid { grid-template-columns: minmax(0, 1fr); }

	.tc-title a {
		display: -webkit-box;
		white-space: normal;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
}

/* Phones in landscape: keep two columns, compact cards */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
	.tc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tc-excerpt { -webkit-line-clamp: 1; line-clamp: 1; }
}
