/* Tamilcube Resources — Alphabets module (overrides + chart layout) */

/* Disable the masonry grid for this module — we use CSS-grid charts instead. */
.tc-app--alphabets .tc-grid {
	columns: unset;
	display: block;
	margin-top: 16px;
}

/* ---------- Chart wrapper ----------
 * A self-contained scroll panel: bounding the height lets the vowel header
 * row stick to the top of the chart (instead of the page) and the
 * consonant-indicator column stick to the left, on both axes.
 */
.tc-alpha-chart-wrap {
	position: relative;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	max-width: 100%;
	max-height: min(78vh, 760px);
	background: var(--tc-surface);
	border: 1px solid var(--tc-border);
	border-radius: var(--tc-radius);
	box-shadow: var(--tc-shadow);
	padding: 0;
}

.tc-alpha-chart {
	display: grid;
	grid-template-columns: minmax(56px, auto) repeat(13, minmax(78px, 1fr));
	gap: 6px;
	min-width: 1080px;
}

.tc-alpha-chart--sanskrit {
	min-width: 1080px;
}

/* ---------- Cells ---------- */
.tc-alpha-cell {
	background: var(--tc-surface);
	border: 1px solid var(--tc-border);
	border-radius: 12px;
	padding: 10px 8px;
	min-height: 92px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	cursor: pointer;
	font-family: var(--tc-font);
	text-align: center;
	transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
	position: relative;
}

.tc-alpha-cell:hover {
	transform: translateY(-2px);
	box-shadow: var(--tc-shadow);
	background: color-mix(in srgb, var(--tc-accent) 6%, var(--tc-surface));
}

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

.tc-alpha-cell__example {
	font-size: 0.78rem;
	color: var(--tc-muted);
	line-height: 1.2;
	min-height: 1.2em;
}

.tc-alpha-cell__example .has-inline-color.has-vivid-red-color,
.tc-alpha-cell__example span[style*="red"] {
	color: var(--tc-accent-2) !important;
	font-weight: 600;
}

.tc-alpha-cell__letter {
	font-family: var(--tc-font-serif);
	font-weight: 700;
	font-size: 1.6rem;
	line-height: 1.1;
	color: var(--tc-text);
}

.tc-alpha-cell__roman {
	font-size: 0.78rem;
	color: var(--tc-muted);
	font-weight: 500;
	letter-spacing: 0.02em;
}

/* Vowel header row: bigger, gradient text, no example/roman. */
.tc-alpha-cell--header {
	position: sticky;
	top: 0;
	z-index: 2;
	background: linear-gradient(135deg,
		color-mix(in srgb, var(--tc-accent) 14%, var(--tc-surface)),
		color-mix(in srgb, var(--tc-accent-2) 12%, var(--tc-surface)));
	border-color: color-mix(in srgb, var(--tc-accent) 30%, var(--tc-border));
	min-height: 80px;
	cursor: pointer;
}

.tc-alpha-cell--header .tc-alpha-cell__letter {
	font-size: 1.9rem;
	background: linear-gradient(135deg, var(--tc-accent), var(--tc-accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

/* Left indicator column: pure-consonant labels. */
.tc-alpha-cell--indicator {
	position: sticky;
	left: 0;
	z-index: 1;
	background: linear-gradient(135deg,
		color-mix(in srgb, var(--tc-accent) 16%, var(--tc-surface)),
		color-mix(in srgb, var(--tc-accent-2) 14%, var(--tc-surface)));
	border-color: color-mix(in srgb, var(--tc-accent) 30%, var(--tc-border));
	min-height: 88px;
	min-width: 56px;
}

.tc-alpha-cell--indicator .tc-alpha-cell__letter {
	font-size: 1.4rem;
	background: linear-gradient(135deg, var(--tc-accent), var(--tc-accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.tc-alpha-cell--indicator .tc-alpha-cell__roman {
	font-size: 0.72rem;
}

/* Top-left corner cell. */
.tc-alpha-cell--corner {
	position: sticky;
	top: 0;
	left: 0;
	z-index: 3;
	background: var(--tc-surface-2);
	cursor: default;
	min-height: 80px;
}

.tc-alpha-cell--corner:hover {
	transform: none;
	box-shadow: none;
	background: var(--tc-surface-2);
}

.tc-alpha-cell--corner .tc-alpha-cell__label {
	font-size: 0.75rem;
	color: var(--tc-muted);
	font-weight: 600;
}

/* Sanskrit special-character cell spans the row visually. */
.tc-alpha-cell--special {
	grid-column: 1 / -1;
	background: color-mix(in srgb, var(--tc-accent) 5%, var(--tc-surface));
}

.tc-alpha-cell--special .tc-alpha-cell__letter {
	font-size: 2rem;
}

/* ---------- Search / dim ---------- */
.tc-alpha-cell.is-dim {
	opacity: 0.18;
	pointer-events: none;
}

.tc-alpha-cell.is-hit {
	box-shadow: 0 0 0 2px var(--tc-accent), var(--tc-shadow-hover);
}

/* ---------- Non-chart blocks ---------- */
.tc-alpha-iframe,
.tc-alpha-download,
.tc-alpha-promo {
	background: var(--tc-surface);
	border: 1px solid var(--tc-border);
	border-radius: var(--tc-radius);
	box-shadow: var(--tc-shadow);
	padding: 22px;
	margin-top: 4px;
}

.tc-alpha-iframe iframe {
	width: 100%;
	height: 560px;
	border: 0;
	border-radius: 10px;
	background: var(--tc-surface-2);
}

.tc-alpha-iframe__intro,
.tc-alpha-download__intro,
.tc-alpha-promo__intro {
	margin: 0 0 14px;
	color: var(--tc-muted);
	font-size: 1rem;
	line-height: 1.7;
}

.tc-alpha-download {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 18px;
}

.tc-alpha-download__icon {
	flex: none;
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	border-radius: 16px;
	color: #fff;
	background: linear-gradient(135deg, var(--tc-accent), var(--tc-accent-2));
}

.tc-alpha-download__icon svg {
	width: 30px;
	height: 30px;
}

.tc-alpha-download__body {
	flex: 1 1 240px;
}

.tc-alpha-download__intro {
	margin-bottom: 10px;
}

.tc-alpha-download__btn,
.tc-alpha-promo__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 22px;
	border-radius: 999px;
	color: #fff !important;
	text-decoration: none;
	font-weight: 600;
	background: linear-gradient(120deg, var(--tc-accent), var(--tc-accent-2));
	box-shadow: var(--tc-shadow);
	transition: transform 0.12s, box-shadow 0.15s;
	border: 0;
	cursor: pointer;
}

.tc-alpha-download__btn:hover,
.tc-alpha-promo__btn:hover {
	transform: translateY(-2px);
	box-shadow: var(--tc-shadow-hover);
}

.tc-alpha-promo {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.tc-alpha-promo__body {
	flex: 1 1 260px;
}

/* ---------- Modal ---------- */
.tc-alpha-modal {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.tc-alpha-modal.is-open {
	display: flex;
	animation: tc-alpha-fade 0.18s ease;
}

.tc-alpha-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 17, 23, 0.55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.tc-alpha-modal__panel {
	position: relative;
	width: min(680px, 96vw);
	max-height: min(92vh, 920px);
	overflow: auto;
	background: var(--tc-surface);
	color: var(--tc-text);
	border-radius: 22px;
	border: 1px solid var(--tc-border);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
	padding: 28px 24px 24px;
	font-family: var(--tc-font);
}

@keyframes tc-alpha-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.tc-alpha-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid var(--tc-border);
	background: var(--tc-surface);
	color: var(--tc-muted);
	cursor: pointer;
	display: grid;
	place-items: center;
	flex: none;
	padding: 0;
	transition: color 0.15s, background 0.15s;
}

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

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

.tc-alpha-modal__letter {
	font-family: var(--tc-font-serif);
	font-weight: 700;
	font-size: clamp(4.5rem, 4rem + 6vw, 7.5rem);
	line-height: 1;
	text-align: center;
	background: linear-gradient(135deg, var(--tc-accent), var(--tc-accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	margin: 6px 0 10px;
}

.tc-alpha-modal__roman {
	text-align: center;
	font-size: 1.15rem;
	font-weight: 600;
	color: var(--tc-accent);
	letter-spacing: 0.02em;
	margin-bottom: 14px;
}

.tc-alpha-modal__example {
	background: var(--tc-surface-2);
	border-radius: 14px;
	padding: 14px 18px;
	text-align: center;
	font-size: 1.05rem;
	color: var(--tc-text);
	min-height: 1.4em;
	margin-bottom: 16px;
	line-height: 1.5;
}

.tc-alpha-modal__example:empty::before {
	content: "—";
	color: var(--tc-muted);
}

.tc-alpha-modal__example span[style*="red"],
.tc-alpha-modal__example .has-vivid-red-color {
	color: var(--tc-accent-2) !important;
	font-weight: 700;
	font-size: 1.15em;
}

.tc-alpha-modal__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-bottom: 14px;
}

.tc-alpha-modal__actions .tc-action {
	padding: 9px 14px;
	color: var(--tc-text);
	font-weight: 600;
	background: var(--tc-surface-2);
	border: 1px solid var(--tc-border);
}

.tc-alpha-modal__actions .tc-action:hover {
	background: color-mix(in srgb, var(--tc-accent) 14%, var(--tc-surface-2));
	color: var(--tc-text);
}

.tc-alpha-modal__anim {
	margin-top: 8px;
	display: none;
}

.tc-alpha-modal__anim.is-open {
	display: block;
}

.tc-alpha-modal__anim iframe {
	width: 100%;
	height: 380px;
	border: 0;
	border-radius: 12px;
	background: var(--tc-surface-2);
}

/* Hide source artifacts after JS enhances. */
.tc-app--alphabets[data-tc-enhanced] ~ figure.wp-block-table,
.tc-app--alphabets[data-tc-enhanced] ~ hr.wp-block-separator,
.tc-app--alphabets[data-tc-enhanced] ~ h3.wp-block-heading,
.tc-app--alphabets[data-tc-enhanced] ~ .wp-block-file,
.tc-app--alphabets[data-tc-enhanced] ~ .wp-block-buttons {
	display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
	.tc-alpha-chart {
		min-width: 920px;
	}
	.tc-alpha-cell {
		min-height: 80px;
		padding: 8px 6px;
	}
	.tc-alpha-cell__letter { font-size: 1.4rem; }
	.tc-alpha-modal__panel {
		padding: 24px 16px 18px;
	}
	.tc-alpha-modal__anim iframe { height: 320px; }
	.tc-alpha-iframe iframe { height: 420px; }
}

@media print {
	.tc-alpha-chart-wrap { overflow: visible; }
	.tc-alpha-cell { box-shadow: none; }
	.tc-alpha-modal { display: none !important; }
}
