/**
 * TrendyTattle Autopilot — front-end styles.
 *
 * Scoped to .ttap-* so nothing here can leak into a theme. Colours are tokens
 * on :root so a theme can override them without touching this file.
 */

:root {
	--ttap-c-bg: #ffffff;
	--ttap-c-surface: #fbfbfd;
	--ttap-c-border: #e6e8ec;
	--ttap-c-text: #16181d;
	--ttap-c-muted: #6b7280;
	--ttap-c-accent: #6f3ff5;
	--ttap-c-accent-soft: #f2eeff;
	--ttap-c-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 30px rgba(16, 24, 40, .06);
	--ttap-c-radius: 18px;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--ttap-c-bg: #14161a;
		--ttap-c-surface: #1a1d23;
		--ttap-c-border: #2a2f39;
		--ttap-c-text: #eef0f4;
		--ttap-c-muted: #9aa2b1;
		--ttap-c-accent: #a58cff;
		--ttap-c-accent-soft: #241f3d;
		--ttap-c-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 34px rgba(0, 0, 0, .34);
	}
}

:root[data-theme="dark"] {
	--ttap-c-bg: #14161a;
	--ttap-c-surface: #1a1d23;
	--ttap-c-border: #2a2f39;
	--ttap-c-text: #eef0f4;
	--ttap-c-muted: #9aa2b1;
	--ttap-c-accent: #a58cff;
	--ttap-c-accent-soft: #241f3d;
	--ttap-c-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 34px rgba(0, 0, 0, .34);
}

/* =============================================================
 * Credits card
 * ========================================================== */

.ttap-credits {
	position: relative;
	overflow: hidden;
	margin: 48px 0 32px;
	padding: 28px;
	border: 1px solid var(--ttap-c-border);
	border-radius: var(--ttap-c-radius);
	background: var(--ttap-c-surface);
	box-shadow: var(--ttap-c-shadow);
	color: var(--ttap-c-text);
	font-size: 15px;
	line-height: 1.55;
}

.ttap-credits__glow {
	position: absolute;
	top: -140px;
	right: -120px;
	width: 320px;
	height: 320px;
	border-radius: 50%;
	background: radial-gradient(circle, var(--ttap-c-accent-soft) 0%, transparent 68%);
	pointer-events: none;
	opacity: .85;
}

.ttap-credits__head {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 20px;
}

.ttap-credits__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	background: var(--ttap-c-accent-soft);
	color: var(--ttap-c-accent);
}

.ttap-credits__icon svg { width: 21px; height: 21px; }

.ttap-credits__headtext { min-width: 0; }

.ttap-credits__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -.01em;
	line-height: 1.25;
	color: var(--ttap-c-text);
	border: none;
	padding: 0;
}

.ttap-credits__sub {
	margin: 2px 0 0;
	font-size: 13px;
	color: var(--ttap-c-muted);
}

.ttap-credits__list {
	position: relative;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ttap-credits__item { margin: 0; padding: 0; list-style: none; }

.ttap-credits__link {
	display: flex;
	align-items: center;
	gap: 13px;
	padding: 13px 14px;
	border: 1px solid var(--ttap-c-border);
	border-radius: 13px;
	background: var(--ttap-c-bg);
	text-decoration: none;
	color: inherit;
	transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
	height: 100%;
	box-sizing: border-box;
}

.ttap-credits__link:hover,
.ttap-credits__link:focus-visible {
	border-color: var(--ttap-c-accent);
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(111, 63, 245, .13);
	text-decoration: none;
}

.ttap-credits__favicon {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	background: var(--ttap-c-surface);
	object-fit: contain;
	padding: 3px;
	box-sizing: border-box;
	border: 1px solid var(--ttap-c-border);
}

.ttap-credits__meta { flex: 1; min-width: 0; }

.ttap-credits__publisher {
	display: block;
	font-weight: 650;
	font-size: 14px;
	line-height: 1.3;
	color: var(--ttap-c-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ttap-credits__headline {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 12.5px;
	line-height: 1.4;
	color: var(--ttap-c-muted);
	margin-top: 2px;
}

.ttap-credits__domain {
	display: block;
	margin-top: 3px;
	font-size: 11.5px;
	color: var(--ttap-c-muted);
	opacity: .82;
}

.ttap-credits__dot { margin: 0 4px; }

.ttap-credits__arrow {
	flex: 0 0 auto;
	display: inline-flex;
	color: var(--ttap-c-muted);
	opacity: .55;
	transition: opacity .18s ease, transform .18s ease, color .18s ease;
}

.ttap-credits__arrow svg { width: 15px; height: 15px; }

.ttap-credits__link:hover .ttap-credits__arrow {
	opacity: 1;
	color: var(--ttap-c-accent);
	transform: translate(2px, -2px);
}

/* --- Image credits --- */

.ttap-credits__images {
	position: relative;
	margin-top: 22px;
	padding-top: 18px;
	border-top: 1px dashed var(--ttap-c-border);
}

.ttap-credits__subtitle {
	margin: 0 0 12px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ttap-c-muted);
	border: none;
	padding: 0;
}

.ttap-credits__imagelist {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ttap-credits__image {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 6px 12px 6px 6px;
	border: 1px solid var(--ttap-c-border);
	border-radius: 999px;
	background: var(--ttap-c-bg);
	font-size: 12px;
	margin: 0;
	list-style: none;
	max-width: 100%;
}

.ttap-credits__thumb {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 auto;
}

.ttap-credits__imagemeta {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--ttap-c-text);
}

.ttap-credits__imagemeta a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--ttap-c-border); }
.ttap-credits__imagemeta a:hover { color: var(--ttap-c-accent); border-bottom-color: var(--ttap-c-accent); }

.ttap-credits__license { color: var(--ttap-c-muted); margin-left: 4px; }
.ttap-credits__license::before { content: "· "; }

.ttap-credits__note {
	position: relative;
	margin: 20px 0 0;
	padding-top: 16px;
	border-top: 1px solid var(--ttap-c-border);
	font-size: 12px;
	line-height: 1.6;
	color: var(--ttap-c-muted);
}

/* --- Compact & minimal variants --- */

.ttap-credits--compact { padding: 22px; }
.ttap-credits--compact .ttap-credits__list { grid-template-columns: 1fr; gap: 6px; }
.ttap-credits--compact .ttap-credits__link { padding: 9px 11px; border-radius: 10px; }
.ttap-credits--compact .ttap-credits__headline { display: none; }

.ttap-credits--minimal {
	padding: 18px 0 0;
	background: none;
	border: none;
	border-top: 1px solid var(--ttap-c-border);
	border-radius: 0;
	box-shadow: none;
}

.ttap-credits--minimal .ttap-credits__glow,
.ttap-credits--minimal .ttap-credits__icon,
.ttap-credits--minimal .ttap-credits__headline,
.ttap-credits--minimal .ttap-credits__favicon { display: none; }

.ttap-credits--minimal .ttap-credits__link {
	border: none;
	padding: 5px 0;
	background: none;
	box-shadow: none;
}

.ttap-credits--minimal .ttap-credits__link:hover { transform: none; box-shadow: none; }

/* =============================================================
 * Related posts
 * ========================================================== */

.ttap-related { margin: 44px 0 20px; }

.ttap-related__title {
	margin: 0 0 18px;
	font-size: 20px;
	font-weight: 750;
	letter-spacing: -.02em;
	color: var(--ttap-c-text);
}

.ttap-related__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
}

.ttap-related__card { margin: 0; }

.ttap-related__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	text-decoration: none;
	color: inherit;
	border-radius: 14px;
	overflow: hidden;
	background: var(--ttap-c-bg);
	border: 1px solid var(--ttap-c-border);
	transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.ttap-related__link:hover,
.ttap-related__link:focus-visible {
	transform: translateY(-3px);
	border-color: var(--ttap-c-accent);
	box-shadow: 0 10px 28px rgba(16, 24, 40, .12);
	text-decoration: none;
}

.ttap-related__media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--ttap-c-surface);
}

.ttap-related__media img,
.ttap-related__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .4s ease;
}

.ttap-related__link:hover .ttap-related__image { transform: scale(1.04); }

.ttap-related__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, var(--ttap-c-accent-soft), var(--ttap-c-surface));
}

.ttap-related__badge {
	position: absolute;
	left: 10px;
	bottom: 10px;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .68);
	backdrop-filter: blur(6px);
	color: #fff;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.ttap-related__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 13px 14px 15px;
	flex: 1;
}

.ttap-related__headline {
	font-size: 14.5px;
	font-weight: 650;
	line-height: 1.35;
	color: var(--ttap-c-text);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ttap-related__date { font-size: 11.5px; color: var(--ttap-c-muted); margin-top: auto; }

/* =============================================================
 * Inline read-next
 * ========================================================== */

.ttap-readnext { margin: 30px 0; }

.ttap-readnext__link {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 15px 18px;
	border-left: 4px solid var(--ttap-c-accent);
	border-radius: 0 12px 12px 0;
	background: var(--ttap-c-accent-soft);
	text-decoration: none;
	color: inherit;
	transition: transform .18s ease;
}

.ttap-readnext__link:hover { transform: translateX(3px); text-decoration: none; }

.ttap-readnext__label {
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: .13em;
	text-transform: uppercase;
	color: var(--ttap-c-accent);
}

.ttap-readnext__headline {
	font-size: 16px;
	font-weight: 650;
	line-height: 1.35;
	color: var(--ttap-c-text);
}

/* =============================================================
 * In-article furniture
 * ========================================================== */

.ttap-takeaways {
	margin: 28px 0;
	padding: 20px 24px;
	border-radius: 14px;
	background: var(--ttap-c-surface);
	border: 1px solid var(--ttap-c-border);
}

.ttap-takeaways h2 {
	margin: 0 0 12px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ttap-c-accent);
}

.ttap-takeaways ul { margin: 0; padding-left: 20px; }

.ttap-takeaways li {
	margin-bottom: 8px;
	line-height: 1.55;
	font-size: 15.5px;
}

.ttap-takeaways li:last-child { margin-bottom: 0; }

.ttap-toc {
	margin: 26px 0;
	padding: 18px 22px;
	border: 1px solid var(--ttap-c-border);
	border-radius: 13px;
	background: var(--ttap-c-bg);
}

.ttap-toc__title {
	margin: 0 0 10px;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ttap-c-muted);
}

.ttap-toc__list {
	margin: 0;
	padding-left: 20px;
	columns: 2;
	column-gap: 28px;
}

@media (max-width: 640px) {
	.ttap-toc__list { columns: 1; }
}

.ttap-toc__item {
	margin-bottom: 6px;
	break-inside: avoid;
	font-size: 14.5px;
}

.ttap-toc__link {
	color: var(--ttap-c-text);
	text-decoration: none;
	border-bottom: 1px solid transparent;
}

.ttap-toc__link:hover {
	color: var(--ttap-c-accent);
	border-bottom-color: var(--ttap-c-accent);
}

.ttap-pullquote {
	margin: 34px 0;
	padding: 4px 0 4px 26px;
	border-left: 4px solid var(--ttap-c-accent);
	font-size: 21px;
	font-weight: 500;
	line-height: 1.42;
	font-style: normal;
	letter-spacing: -.015em;
	color: var(--ttap-c-text);
}

.ttap-pullquote p { margin: 0; }

.ttap-figure { margin: 30px 0; }

.ttap-figure img {
	border-radius: 12px;
	display: block;
	width: 100%;
	height: auto;
}

.ttap-figcaption {
	margin-top: 9px;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--ttap-c-muted);
	text-align: center;
}

.ttap-internal-link {
	color: var(--ttap-c-accent);
	text-decoration: none;
	border-bottom: 1px solid rgba(111, 63, 245, .3);
	transition: border-color .15s ease;
}

.ttap-internal-link:hover { border-bottom-color: var(--ttap-c-accent); }

.ttap-external-link {
	text-decoration: none;
	border-bottom: 1px dotted currentColor;
}

/* =============================================================
 * Small screens
 * ========================================================== */

@media (max-width: 600px) {
	.ttap-credits { padding: 20px 16px; margin: 34px 0 26px; border-radius: 14px; }
	.ttap-credits__list { grid-template-columns: 1fr; }
	.ttap-credits__icon { width: 36px; height: 36px; }
	.ttap-credits__title { font-size: 16px; }
	.ttap-related__grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
	.ttap-related__title { font-size: 18px; }
	.ttap-pullquote { font-size: 18px; padding-left: 18px; }
	.ttap-takeaways { padding: 16px 18px; }
	.ttap-toc { padding: 15px 18px; }
}

@media (prefers-reduced-motion: reduce) {
	.ttap-credits__link,
	.ttap-related__link,
	.ttap-related__image,
	.ttap-readnext__link,
	.ttap-credits__arrow {
		transition: none;
	}

	.ttap-credits__link:hover,
	.ttap-related__link:hover,
	.ttap-readnext__link:hover { transform: none; }
}

@media print {
	.ttap-related,
	.ttap-readnext { display: none; }

	.ttap-credits { box-shadow: none; border: 1px solid #ccc; }
}
