/* Tamilcube Resources — shared core styles
 * Used by every module (Quotes, Proverbs, …). Scoped under .tc-app so the
 * page stays readable if JS fails.
 */

.tc-app {
	--tc-bg: #f6f7fb;
	--tc-surface: #ffffff;
	--tc-surface-2: #f0f2f8;
	--tc-text: #1f2533;
	--tc-muted: #6b7280;
	--tc-accent: #6d4aff;
	--tc-accent-2: #ff5d8f;
	--tc-border: rgba(17, 24, 39, 0.08);
	--tc-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.08);
	--tc-shadow-hover: 0 2px 6px rgba(16, 24, 40, 0.08), 0 18px 40px rgba(16, 24, 40, 0.14);
	--tc-radius: 18px;
	--tc-font: "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--tc-font-serif: "Noto Serif Tamil", Georgia, serif;

	font-family: var(--tc-font);
	color: var(--tc-text);
	max-width: 1240px;
	margin-inline: auto;
	padding: 8px clamp(12px, 4vw, 32px) 96px;
	-webkit-font-smoothing: antialiased;
}

.tc-app[data-theme="dark"] {
	--tc-bg: #0f1117;
	--tc-surface: #181b24;
	--tc-surface-2: #20242f;
	--tc-text: #e8eaf1;
	--tc-muted: #9aa3b2;
	--tc-accent: #9a8bff;
	--tc-accent-2: #ff7da6;
	--tc-border: rgba(255, 255, 255, 0.09);
	--tc-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.45);
	--tc-shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.5), 0 20px 48px rgba(0, 0, 0, 0.55);
}

/* Paint a page-wide backdrop without touching the theme's body. */
.tc-app[data-tc-enhanced]::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	background:
		radial-gradient(1100px 480px at 12% -10%, color-mix(in srgb, var(--tc-accent) 16%, transparent), transparent 60%),
		radial-gradient(900px 420px at 100% 0%, color-mix(in srgb, var(--tc-accent-2) 14%, transparent), transparent 55%),
		var(--tc-bg);
}

.tc-app *,
.tc-app *::before,
.tc-app *::after {
	box-sizing: border-box;
}

/* ---------- Hero ---------- */
.tc-hero {
	text-align: center;
	padding: 28px 8px 8px;
}

.tc-hero__title {
	font-family: var(--tc-font-serif);
	font-size: clamp(1.9rem, 1.2rem + 3vw, 3.2rem);
	line-height: 1.25;
	margin: 0 0 8px;
	background: linear-gradient(120deg, var(--tc-accent), var(--tc-accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.tc-hero__subtitle {
	color: var(--tc-muted);
	font-size: clamp(0.95rem, 0.9rem + 0.4vw, 1.15rem);
	margin: 0;
}

/* ---------- Toolbar ---------- */
.tc-toolbar {
	position: sticky;
	top: 0;
	z-index: 30;
	margin: 14px 0 22px;
	padding: 10px 0;
	background: color-mix(in srgb, var(--tc-bg) 86%, transparent);
	backdrop-filter: saturate(140%) blur(10px);
	-webkit-backdrop-filter: saturate(140%) blur(10px);
}

.tc-toolbar__inner {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.tc-controls {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.tc-search {
	position: relative;
	flex: 1 1 260px;
	min-width: 200px;
}

.tc-search input {
	width: 100%;
	font-family: var(--tc-font);
	font-size: 1rem;
	color: var(--tc-text);
	padding: 12px 38px 12px 42px;
	border-radius: 999px;
	border: 1px solid var(--tc-border);
	background: var(--tc-surface);
	box-shadow: var(--tc-shadow);
	outline: none;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.tc-search input:focus {
	border-color: var(--tc-accent);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc-accent) 22%, transparent);
}

.tc-search__icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--tc-muted);
	pointer-events: none;
}

.tc-search__clear {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	border: 0;
	background: transparent;
	color: var(--tc-muted);
	cursor: pointer;
	padding: 6px;
	border-radius: 999px;
	display: none;
}

.tc-search__clear:hover {
	color: var(--tc-text);
	background: var(--tc-surface-2);
}

.tc-search.is-filled .tc-search__clear {
	display: inline-flex;
}

.tc-btn {
	font-family: var(--tc-font);
	font-size: 0.95rem;
	color: var(--tc-text);
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 11px 16px;
	border-radius: 999px;
	border: 1px solid var(--tc-border);
	background: var(--tc-surface);
	box-shadow: var(--tc-shadow);
	cursor: pointer;
	white-space: nowrap;
	transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}

.tc-btn:hover {
	transform: translateY(-1px);
	box-shadow: var(--tc-shadow-hover);
}

.tc-btn:active {
	transform: translateY(0);
}

.tc-chips {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding-bottom: 4px;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
}

.tc-chips::-webkit-scrollbar {
	height: 6px;
}

.tc-chips::-webkit-scrollbar-thumb {
	background: var(--tc-border);
	border-radius: 999px;
}

.tc-chip {
	font-family: var(--tc-font);
	font-size: 0.9rem;
	color: var(--tc-muted);
	padding: 8px 14px;
	border-radius: 999px;
	border: 1px solid var(--tc-border);
	background: var(--tc-surface);
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.tc-chip:hover {
	color: var(--tc-text);
}

.tc-chip.is-active {
	color: #fff;
	border-color: transparent;
	background: linear-gradient(120deg, var(--tc-accent), var(--tc-accent-2));
}

/* ---------- Sections & accordion ---------- */
.tc-section {
	margin: 26px 0 8px;
	scroll-margin-top: 150px;
}

.tc-section__title {
	margin: 0;
}

.tc-section__toggle {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border: 1px solid var(--tc-border);
	border-radius: 14px;
	background: var(--tc-surface);
	box-shadow: var(--tc-shadow);
	cursor: pointer;
	color: var(--tc-text);
	font-family: var(--tc-font-serif);
	font-size: clamp(1.15rem, 1.05rem + 1vw, 1.7rem);
	text-align: start;
	transition: box-shadow 0.15s, transform 0.12s;
}

.tc-section__toggle:hover {
	box-shadow: var(--tc-shadow-hover);
	transform: translateY(-1px);
}

.tc-section__toggle:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--tc-accent) 55%, transparent);
	outline-offset: 2px;
}

.tc-section__chev {
	flex: none;
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 9px;
	color: #fff;
	background: linear-gradient(135deg, var(--tc-accent), var(--tc-accent-2));
	transition: transform 0.2s ease;
}

.tc-section__chev svg {
	width: 18px;
	height: 18px;
}

.tc-section.is-collapsed .tc-section__chev {
	transform: rotate(-90deg);
}

.tc-section__name {
	flex: 1 1 auto;
}

.tc-section__count {
	flex: none;
	font-family: var(--tc-font);
	font-size: 0.78rem;
	color: var(--tc-muted);
	font-weight: 500;
	background: var(--tc-surface-2);
	padding: 4px 10px;
	border-radius: 999px;
}

.tc-section.is-collapsed .tc-grid {
	display: none;
}

/* While searching, matched sections stay open regardless of collapse state. */
.tc-app.is-search .tc-section.is-collapsed .tc-grid {
	display: block;
}

/* ---------- Grid & cards ---------- */
.tc-grid {
	column-gap: 20px;
	margin-top: 16px;
}

.tc-card {
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
	display: inline-block;
	width: 100%;
	margin: 0 0 20px;
	background: var(--tc-surface);
	border: 1px solid var(--tc-border);
	border-radius: var(--tc-radius);
	box-shadow: var(--tc-shadow);
	overflow: hidden;
	position: relative;
	transition: transform 0.16s ease, box-shadow 0.18s ease;
}

.tc-card::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 5px;
	background: linear-gradient(180deg, var(--tc-accent), var(--tc-accent-2));
	opacity: 0.85;
}

.tc-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--tc-shadow-hover);
}

.tc-card.is-feature {
	column-span: all;
	-webkit-column-span: all;
}

.tc-card__body {
	padding: 22px 22px 14px 26px;
	font-size: 1.06rem;
	line-height: 1.95;
}

.tc-card__body p {
	margin: 0 0 0.7em;
}

.tc-card__body p:last-child {
	margin-bottom: 0;
}

.tc-card__actions {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px 12px 26px;
	border-top: 1px dashed var(--tc-border);
}

.tc-action {
	border: 0;
	background: transparent;
	color: var(--tc-muted);
	font-family: var(--tc-font);
	font-size: 0.86rem;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 11px;
	border-radius: 999px;
	cursor: pointer;
	transition: color 0.15s, background 0.15s;
}

.tc-action:hover {
	color: var(--tc-accent);
	background: var(--tc-surface-2);
}

.tc-action svg {
	width: 17px;
	height: 17px;
}

.tc-action__spacer {
	margin-left: auto;
}

/* ---------- Share popover ---------- */
.tc-share {
	position: relative;
}

.tc-share__menu {
	position: absolute;
	right: 0;
	bottom: calc(100% + 8px);
	min-width: 196px;
	background: var(--tc-surface);
	border: 1px solid var(--tc-border);
	border-radius: 14px;
	box-shadow: var(--tc-shadow-hover);
	padding: 6px;
	display: none;
	flex-direction: column;
	gap: 2px;
	z-index: 40;
}

.tc-share.is-open .tc-share__menu {
	display: flex;
	animation: tc-pop 0.14s ease;
}

@keyframes tc-pop {
	from { opacity: 0; transform: translateY(6px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.tc-share__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px;
	border-radius: 9px;
	border: 0;
	background: transparent;
	color: var(--tc-text);
	font-family: var(--tc-font);
	font-size: 0.92rem;
	text-align: start;
	cursor: pointer;
	text-decoration: none;
	width: 100%;
}

.tc-share__item:hover {
	background: var(--tc-surface-2);
}

.tc-share__item svg {
	width: 18px;
	height: 18px;
	flex: none;
}

.tc-ic-wa { color: #25d366; }
.tc-ic-tw { color: #1d9bf0; }
.tc-ic-fb { color: #1877f2; }
.tc-ic-tg { color: #29a9eb; }

/* ---------- States ---------- */
.tc-noresults {
	display: none;
	text-align: center;
	color: var(--tc-muted);
	font-size: 1.05rem;
	padding: 60px 16px;
}

.tc-app.is-empty .tc-noresults {
	display: block;
}

.tc-card.is-hit {
	animation: tc-glow 1.6s ease;
}

@keyframes tc-glow {
	0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tc-accent) 65%, transparent); }
	30% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--tc-accent) 35%, transparent); }
	100% { box-shadow: var(--tc-shadow); }
}

/* ---------- Back to top ---------- */
.tc-top {
	position: fixed;
	right: 22px;
	bottom: 22px;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 0;
	color: #fff;
	background: linear-gradient(120deg, var(--tc-accent), var(--tc-accent-2));
	box-shadow: var(--tc-shadow-hover);
	cursor: pointer;
	display: grid;
	place-items: center;
	opacity: 0;
	transform: translateY(14px) scale(0.9);
	pointer-events: none;
	transition: opacity 0.2s, transform 0.2s;
	z-index: 50;
}

.tc-top.is-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* ---------- Toast ---------- */
.tc-toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	transform: translate(-50%, 20px);
	background: var(--tc-text);
	color: var(--tc-bg);
	font-family: var(--tc-font);
	font-size: 0.95rem;
	padding: 12px 20px;
	border-radius: 999px;
	box-shadow: var(--tc-shadow-hover);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s, transform 0.2s;
	z-index: 60;
}

.tc-toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
	.tc-grid { columns: 1 !important; }
	.tc-section { scroll-margin-top: 180px; }
	.tc-controls { gap: 8px; }
	.tc-btn { padding: 10px 13px; font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
	.tc-app *,
	.tc-app *::before,
	.tc-app *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

@media print {
	.tc-toolbar,
	.tc-card__actions,
	.tc-top,
	.tc-toast { display: none !important; }
	.tc-grid { columns: 1 !important; }
	.tc-card { box-shadow: none; border: 1px solid #ccc; }
}
