/**
 * Tatoeba — Estilos del bloque de frases
 * Usa variables CSS del tema Velox para consistencia visual.
 */

/* ── Sección principal ───────────────────────────────────────────────────── */
.tatoeba-section {
	margin: 2.5rem 0;
	container-type: inline-size;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.tatoeba-header {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
	margin-bottom: 1.25rem;
	flex-wrap: wrap;
}

.tatoeba-title {
	font-size: clamp(1.1rem, 2.5cqw, 1.35rem);
	font-weight: 700;
	margin: 0;
	color: var(--color-heading, #1a1a1a);
	line-height: 1.3;
}

.tatoeba-kanji-highlight {
	color: var(--color-primary, #e63946);
	font-size: 1.1em;
}

.tatoeba-count {
	font-size: 0.8rem;
	color: var(--color-muted, #777);
	background: var(--color-surface-alt, #f5f5f5);
	padding: 0.2em 0.6em;
	border-radius: 99px;
	white-space: nowrap;
}

/* ── Lista ───────────────────────────────────────────────────────────────── */
.tatoeba-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* ── Item ────────────────────────────────────────────────────────────────── */
.tatoeba-item {
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-rows: auto auto;
	gap: 0.3rem 0.75rem;
	padding: 0.9rem 1.1rem;
	background: var(--color-surface, #fff);
	border: 1px solid var(--color-border, #e8e8e8);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(0,0,0,.04);
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.tatoeba-item:hover {
	box-shadow: 0 4px 14px rgba(0,0,0,.08);
	transform: translateY(-1px);
}

/* ── Texto japonés con furigana ──────────────────────────────────────────── */
.tatoeba-item__jp {
	grid-column: 1;
	grid-row: 1;
	font-size: 1.2rem;
	line-height: 2;         /* espacio para furigana <rt> */
	color: var(--color-text, #222);
	font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
}

.tatoeba-item__jp ruby rt {
	font-size: var(--rt-size, 0.55em);
	color: var(--ruby-color, var(--color-text-muted, #555));
}

/* ── Traducción española ─────────────────────────────────────────────────── */
.tatoeba-item__es {
	grid-column: 1;
	grid-row: 2;
	font-size: 0.9rem;
	color: var(--color-text-muted, #555);
	line-height: 1.5;
}

/* ── Botón de audio ──────────────────────────────────────────────────────── */
.tatoeba-item__audio {
	grid-column: 2;
	grid-row: 1 / 3;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tatoeba-play-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: none;
	border-radius: 50%;
	background: var(--color-primary, #e63946);
	color: #fff;
	cursor: pointer;
	transition: background 0.18s ease, transform 0.15s ease, opacity 0.15s;
	flex-shrink: 0;
}

.tatoeba-play-btn:hover {
	background: var(--color-primary-dark, #c1121f);
	transform: scale(1.1);
}

.tatoeba-play-btn:active {
	transform: scale(0.96);
}

.tatoeba-play-btn.is-playing {
	background: var(--color-success, #2a9d8f);
}

.tatoeba-play-btn[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
}

/* ── Skeleton loader ─────────────────────────────────────────────────────── */
.tatoeba-loading {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.tatoeba-skeleton {
	padding: 0.9rem 1.1rem;
	border: 1px solid var(--color-border, #e8e8e8);
	border-radius: 10px;
}

.tatoeba-skeleton__japanese,
.tatoeba-skeleton__translation {
	border-radius: 4px;
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: tatoeba-shimmer 1.4s infinite;
}

.tatoeba-skeleton__japanese {
	height: 1.5rem;
	width: 60%;
	margin-bottom: 0.5rem;
}

.tatoeba-skeleton__translation {
	height: 1rem;
	width: 85%;
}

@keyframes tatoeba-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

.tatoeba-loading__msg {
	text-align: center;
	font-size: 0.85rem;
	color: var(--color-muted, #999);
	margin: 0.5rem 0 0;
}

/* ── Paginación ──────────────────────────────────────────────────────────── */
.tatoeba-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin-top: 1.5rem;
}

.tatoeba-page-btn {
	padding: 0.5rem 1rem;
	background: var(--color-surface, #fff);
	border: 1px solid var(--color-border, #e8e8e8);
	border-radius: 6px;
	color: var(--color-text, #222);
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: 500;
	transition: all 0.2s ease;
	box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.tatoeba-page-btn:hover:not(:disabled) {
	background: var(--color-primary-light, #f8edeb);
	border-color: var(--color-primary, #e63946);
	color: var(--color-primary, #e63946);
}

.tatoeba-page-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	background: #fcfcfc;
}

.tatoeba-page-info {
	font-size: 0.85rem;
	color: var(--color-text-muted, #555);
	font-weight: 500;
}

/* ── Atribución ──────────────────────────────────────────────────────────── */
.tatoeba-attribution {
	margin-top: 1rem;
	font-size: 0.75rem;
	color: var(--color-text-muted, #555);
}

.tatoeba-attribution a {
	color: var(--color-text-muted, #555);
	text-decoration: underline dotted;
}

/* ── Item entrante (animación AJAX) ──────────────────────────────────────── */
.tatoeba-item--entering {
	animation: tatoeba-fade-in 0.25s ease both;
}

@keyframes tatoeba-fade-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@container (max-width: 480px) {
	.tatoeba-item {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto auto;
	}

	.tatoeba-item__audio {
		grid-column: 1;
		grid-row: 3;
		justify-content: flex-start;
	}

	.tatoeba-item__jp { font-size: 1.05rem; }
}
