/* =========================================================
   Hlášky, frky, brepty — štýly
   Papierový / "písací stroj" dizajn, responzívny.
   ========================================================= */

:root {
	/* Farby */
	--paper: #fbf8ef;
	--paper-2: #fffdf7;
	--ink: #2f2f45;
	--ink-soft: #5a5a70;
	--muted: #8b8b9c;
	--line: #e7e2d3;
	--accent: #c0392b;          /* "červené pero" učiteľa */
	--accent-soft: #f6e4e0;
	--accent-ink: #9a2c20;
	--shadow: 0 10px 30px rgba(47, 47, 69, 0.10);
	--shadow-sm: 0 3px 10px rgba(47, 47, 69, 0.08);

	/* Rozmery */
	--radius: 14px;
	--radius-sm: 10px;
	--wrap: 1080px;

	/* Fonty */
	--font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
	--font-quote: 'Special Elite', 'Courier New', cursive;
}

/* ---------- Reset / základ ---------- */
* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	font-family: var(--font-ui);
	color: var(--ink);
	background-color: var(--paper);
	/* jemné linky ako v zošite */
	background-image: repeating-linear-gradient(
		to bottom,
		transparent,
		transparent 31px,
		rgba(63, 63, 90, 0.05) 31px,
		rgba(63, 63, 90, 0.05) 32px
	);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

main {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
}

.wrap {
	width: min(100% - 2.5rem, var(--wrap));
	margin-inline: auto;
}

.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;
}

/* ---------- Hlavička + navigácia ---------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 20;
	background: var(--paper);
	border-bottom: 1px solid var(--line);
}

.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1.5rem;
	padding: 0.9rem 0;
}

.brand {
	text-decoration: none;
	color: var(--ink);
}

.brand__title {
	font-family: var(--font-quote);
	font-size: clamp(1.4rem, 3.5vw, 1.9rem);
	letter-spacing: 0.5px;
}

.nav {
	position: relative;
	display: flex;
	gap: 0.35rem;
	background: var(--paper-2);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 0.25rem;
}

/* Posuvný "pill" indikátor pod aktívnou položkou */
.nav__indicator {
	position: absolute;
	top: 0;
	left: 0;
	width: 0;
	height: 0;
	background: var(--accent);
	border-radius: 999px;
	box-shadow: 0 3px 10px rgba(192, 57, 43, 0.28);
	transform: translate(0, 0);
	transition:
		transform 0.34s cubic-bezier(0.22, 0.61, 0.36, 1),
		width 0.34s cubic-bezier(0.22, 0.61, 0.36, 1),
		height 0.34s cubic-bezier(0.22, 0.61, 0.36, 1);
	pointer-events: none;
	z-index: 0;
}

.nav__link {
	position: relative;
	z-index: 1;
	text-decoration: none;
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--ink-soft);
	padding: 0.45rem 1.05rem;
	border-radius: 999px;
	transition: color 0.25s ease;
	white-space: nowrap;
}

.nav__link:not(.is-active):hover {
	color: var(--accent-ink);
}

.nav__link.is-active {
	color: #fff;
}

.nav__link:focus-visible {
	outline: 3px solid var(--accent-soft);
	outline-offset: 2px;
}

/* ---------- View (prepínané "podstránky") ---------- */
.view {
	padding-block: clamp(1.5rem, 4vw, 2.5rem);
}

.view[hidden] {
	display: none;
}

/* Vstupná animácia pri prepnutí view (toggle) */
.view.is-entering {
	animation: view-in 0.34s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes view-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---------- Hero: náhodná hláška ---------- */
.hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: clamp(2rem, 6vw, 4rem) 0;
}

.quote-card {
	position: relative;
	background: var(--paper-2);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	max-width: 720px;
	width: 100%;
	margin: 0;
	padding: clamp(2rem, 5vw, 3.25rem) clamp(1.5rem, 5vw, 3.5rem);
}

/* dekoratívne úvodzovky */
.quote-card::before {
	content: '“';
	position: absolute;
	top: -0.35em;
	left: 0.15em;
	font-family: var(--font-quote);
	font-size: clamp(4rem, 12vw, 7rem);
	line-height: 1;
	color: var(--accent-soft);
	pointer-events: none;
}

.quote-card__text {
	position: relative;
	font-family: var(--font-quote);
	font-size: clamp(1.35rem, 4.2vw, 2.25rem);
	line-height: 1.45;
	margin: 0;
	color: var(--ink);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.quote-card__cite {
	margin-top: 1.4rem;
	font-style: normal;
	font-size: clamp(0.95rem, 2.4vw, 1.15rem);
	color: var(--accent-ink);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.quote-card__dash {
	color: var(--muted);
	margin-right: 0.35rem;
}

/* animácia pri výmene hlášky */
.quote-card.is-swapping .quote-card__text {
	opacity: 0;
	transform: translateY(8px);
}

.hero__actions {
	margin-top: clamp(1.5rem, 4vw, 2.25rem);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.6rem;
}

.hero__hint {
	margin: 0;
	font-size: 0.85rem;
	color: var(--muted);
}

kbd {
	font-family: var(--font-ui);
	font-size: 0.78rem;
	background: #fff;
	border: 1px solid var(--line);
	border-bottom-width: 2px;
	border-radius: 6px;
	padding: 0.05rem 0.4rem;
	color: var(--ink-soft);
}

/* ---------- Tlačidlá ---------- */
.btn {
	font-family: var(--font-ui);
	font-size: 1rem;
	font-weight: 600;
	border: 1px solid transparent;
	border-radius: 999px;
	padding: 0.8rem 1.6rem;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:focus-visible {
	outline: 3px solid var(--accent-soft);
	outline-offset: 2px;
}

.btn--primary {
	background: var(--accent);
	color: #fff;
	box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
	background: var(--accent-ink);
	transform: translateY(-2px);
	box-shadow: 0 8px 18px rgba(192, 57, 43, 0.28);
}

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

.btn__icon {
	font-size: 1.15em;
	line-height: 1;
}

/* ---------- Directory (zoznam) ---------- */
.directory {
	padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(3rem, 7vw, 5rem);
	border-top: 1px solid var(--line);
}

.directory__head {
	text-align: center;
	margin-bottom: 1.75rem;
}

.section-title {
	font-family: var(--font-quote);
	font-weight: 400;
	font-size: clamp(1.6rem, 4.5vw, 2.4rem);
	margin: 0;
}

.section-lead {
	margin: 0.5rem auto 0;
	max-width: 52ch;
	color: var(--ink-soft);
}

/* Ovládanie: hľadanie + filtre */
.controls {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	align-items: center;
	margin-bottom: 1rem;
}

.search {
	width: min(100%, 480px);
}

.search__input {
	width: 100%;
	font-family: var(--font-ui);
	font-size: 1rem;
	color: var(--ink);
	background: var(--paper-2);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 0.75rem 1.25rem;
	box-shadow: var(--shadow-sm);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search__input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.chips {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
}

.chip {
	font-family: var(--font-ui);
	font-size: 0.9rem;
	font-weight: 500;
	border: 1px solid var(--line);
	background: var(--paper-2);
	color: var(--ink-soft);
	border-radius: 999px;
	padding: 0.4rem 0.95rem;
	cursor: pointer;
	transition: all 0.15s ease;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.chip:hover {
	border-color: var(--accent);
	color: var(--accent-ink);
}

.chip:focus-visible {
	outline: 3px solid var(--accent-soft);
	outline-offset: 2px;
}

.chip.is-active {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}

.chip__count {
	font-size: 0.78rem;
	font-variant-numeric: tabular-nums;
	background: rgba(0, 0, 0, 0.08);
	border-radius: 999px;
	padding: 0.05rem 0.45rem;
}

.chip.is-active .chip__count {
	background: rgba(255, 255, 255, 0.25);
}

/* ---------- Zoznam učiteľov a hlášok ---------- */
.teachers {
	display: flex;
	flex-direction: column;
	gap: clamp(1.75rem, 4vw, 2.75rem);
}

.teacher {
	scroll-margin-top: 1rem;
}

.teacher__head {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
	padding-bottom: 0.6rem;
	margin-bottom: 1rem;
	border-bottom: 2px solid var(--accent-soft);
}

.teacher__name {
	font-family: var(--font-quote);
	font-weight: 400;
	font-size: clamp(1.35rem, 3.5vw, 1.9rem);
	margin: 0;
	color: var(--accent-ink);
	letter-spacing: 0.5px;
}

.teacher__count {
	font-size: 0.9rem;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.quote-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 0.9rem;
}

.quote-item {
	position: relative;
	background: var(--paper-2);
	border: 1px solid var(--line);
	border-left: 3px solid var(--accent);
	border-radius: var(--radius-sm);
	padding: 1rem 1.1rem;
	box-shadow: var(--shadow-sm);
	font-family: var(--font-quote);
	font-size: 1.02rem;
	line-height: 1.5;
	color: var(--ink);
	transition: transform 0.15s ease, box-shadow 0.2s ease;
}

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

.quote-item mark {
	background: #fff2a8;
	color: inherit;
	padding: 0 0.1em;
	border-radius: 3px;
}

/* ---------- Prázdny stav ---------- */
.empty-state {
	text-align: center;
	color: var(--muted);
	font-size: 1.05rem;
	padding: 2.5rem 0;
}

/* ---------- Chybové hlásenie (načítanie JSON) ---------- */
.load-error {
	max-width: 640px;
	margin: 1rem auto;
	background: var(--accent-soft);
	border: 1px solid #eccbc4;
	color: var(--accent-ink);
	border-radius: var(--radius-sm);
	padding: 1rem 1.25rem;
	text-align: center;
}

.load-error code {
	font-family: 'Courier New', monospace;
	background: rgba(0, 0, 0, 0.06);
	padding: 0.1rem 0.35rem;
	border-radius: 4px;
}

/* ---------- Responzívne úpravy ---------- */
@media (max-width: 640px) {
	/* Prepínač (navigácia) hore a vycentrovaný */
	.site-header__inner {
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 0.55rem;
	}

	.nav {
		width: max-content;
		max-width: 100%;
	}

	/* View "Náhodná hláška" vyplní celú výšku obrazovky (len keď je viditeľné) */
	#view-random:not([hidden]) {
		flex: 1 0 auto;
		display: flex;
		flex-direction: column;
		padding-block: 1.25rem;
	}

	#view-random .hero {
		flex: 1;
		padding: 0;
	}

	/* Hláška vycentrovaná do stredu stránky */
	#view-random .quote-card {
		margin-block: auto;
	}

	/* Tlačidlo pre náhodnú hlášku na spodku obrazovky */
	#view-random .hero__actions {
		margin-top: 0;
		padding-top: 1.5rem;
	}

	/* Na mobile bez fyzickej klávesnice nemá tip zmysel */
	.hero__hint {
		display: none;
	}
}

@media (max-width: 560px) {
	.quote-list {
		grid-template-columns: 1fr;
	}

	.quote-card::before {
		left: 0.05em;
	}
}

/* ---------- Rešpekt k preferenciám používateľa ---------- */
@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.001ms !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}
