/**
 * DZM Program Timeline – frontend.
 */

.dzm-timeline {
	--dzm-label-w: 210px;
	--dzm-lane-h: 44px;
	--dzm-hour-w: 110px;
	--dzm-hours: 8;
	--dzm-radius: 5px;
	--dzm-line: rgba(0, 0, 0, 0.09);
	--dzm-border: rgba(0, 0, 0, 0.14);
	--dzm-bg: #fff;
	--dzm-text: #14161a;
	--dzm-muted: #5c6470;

	box-sizing: border-box;
	color: var(--dzm-text);
	font-size: 16px;
	line-height: 1.4;
	margin: 0 0 2rem;
	position: relative;

	/*
	 * Ve flex nebo grid rodiči (běžné v šablonách) má položka min-width: auto,
	 * takže by se roztáhla na šířku Gantt chartu, přetáhla stránku do strany
	 * a na mobilu by se timeline nikdy nepřepnula do seznamu. Navíc kvůli
	 * vodorovnému přetečení začne iOS Safari nafukovat velikost písma
	 * v celé stránce.
	 */
	max-width: 100%;
	min-width: 0;

	/* Ochrana proti automatickému zvětšování písma na mobilech. */
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

.dzm-timeline *,
.dzm-timeline *::before,
.dzm-timeline *::after {
	box-sizing: border-box;
}

.dzm-timeline__heading {
	font-size: 1.05em;
	font-weight: 700;
	margin: 0 0 0.35em;
}

.dzm-timeline__note {
	color: var(--dzm-muted);
	font-size: 0.9em;
	margin: 0 0 1em;
}

.dzm-timeline__empty {
	background: #fff8e5;
	border: 1px dashed #d8b458;
	border-radius: var(--dzm-radius);
	color: #6b5417;
	padding: 1em;
}

/* ------------------------------------------------------------------
 * Gantt chart (počítač)
 * ------------------------------------------------------------------ */

.dzm-timeline__gantt-wrap {
	max-width: 100%;
	min-width: 0;
}

.dzm-gantt-scroll {
	-webkit-overflow-scrolling: touch;
	max-width: 100%;
	min-width: 0;
	overflow-x: auto;
	overflow-y: hidden;
	padding-bottom: 4px;
}

.dzm-gantt-scroll:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.dzm-gantt {
	display: grid;
	grid-template-columns: var(--dzm-label-w) minmax(0, 1fr);
	min-width: calc(var(--dzm-label-w) + var(--dzm-hours) * var(--dzm-hour-w));
}

.dzm-gantt__corner,
.dzm-gantt__label {
	background: var(--dzm-bg);
	left: 0;
	position: sticky;
	z-index: 2;
}

.dzm-gantt__corner {
	border-bottom: 1px solid var(--dzm-border);
	z-index: 3;
}

.dzm-gantt__axis {
	border-bottom: 1px solid var(--dzm-border);
	height: 34px;
	position: relative;
}

.dzm-gantt__tick {
	bottom: 0;
	border-left: 1px solid var(--dzm-border);
	position: absolute;
	top: 6px;
}

.dzm-gantt__tick-label {
	color: var(--dzm-muted);
	font-size: 0.78em;
	font-weight: 600;
	left: 4px;
	letter-spacing: 0.01em;
	position: absolute;
	top: -2px;
	white-space: nowrap;
}

/* Poslední popisek by přetekl z grafu, proto se zarovná doleva od čáry. */
.dzm-gantt__tick:last-child .dzm-gantt__tick-label {
	left: auto;
	right: 4px;
}

.dzm-gantt__label {
	align-items: center;
	border-bottom: 1px solid var(--dzm-line);
	display: flex;
	font-weight: 700;
	justify-content: flex-end;
	padding: 0.5rem 0.9rem 0.5rem 0;
	text-align: right;
}

.dzm-gantt__label span {
	hyphens: auto;
	overflow-wrap: anywhere;
}

.dzm-gantt__lanes {
	background-image: linear-gradient(to right, var(--dzm-line) 0 1px, transparent 1px);
	background-position-x: var(--dzm-grid-first, 0);
	background-repeat: repeat;
	background-size: var(--dzm-grid-span, 12.5%) 100%;
	border-bottom: 1px solid var(--dzm-line);
	padding: 4px 0;
}

.dzm-gantt__lane {
	height: var(--dzm-lane-h);
	position: relative;
}

.dzm-bar {
	align-items: center;
	background: var(--dzm-bar, #7c3aed);
	border: 0;
	border-radius: var(--dzm-radius);
	color: var(--dzm-bar-text, #fff);
	display: flex;
	font: inherit;
	font-weight: 700;
	gap: 0.4em;
	height: calc(var(--dzm-lane-h) - 8px);
	left: 0;
	min-width: 6px;
	overflow: hidden;
	padding: 0 0.6em;
	position: absolute;
	text-align: left;
	top: 4px;
	transition: transform 0.12s ease, box-shadow 0.12s ease;
	white-space: nowrap;
}

/*
 * Zkrácený název nekončí třemi tečkami, ale postupným zprůhledněním textu
 * (fade prosvítá barvou baru). Po najetí text pomalu projede tak, aby ho
 * bylo možné přečíst celý.
 */
.dzm-bar__title {
	--dzm-fade: 26px;

	flex: 0 1 auto;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
}

.dzm-bar__text {
	display: inline-block;
	transition: transform var(--dzm-scroll-time, 3s) linear;
	white-space: nowrap;
	will-change: transform;
}

.dzm-bar--truncated .dzm-bar__title {
	-webkit-mask-image: linear-gradient( to right, #000 calc(100% - var(--dzm-fade)), transparent 100% );
	mask-image: linear-gradient( to right, #000 calc(100% - var(--dzm-fade)), transparent 100% );
}

.dzm-bar--truncated:hover .dzm-bar__text,
.dzm-bar--truncated:focus-visible .dzm-bar__text,
.dzm-bar--truncated:focus-within .dzm-bar__text {
	transform: translateX( var( --dzm-shift, 0px ) );
}

/* Čas se vejde jen do širokých barů. */
.dzm-bar__time {
	display: none;
}

.dzm-bar--wide .dzm-bar__time {
	background: rgba(255, 255, 255, 0.92);
	border-radius: 999px;
	color: #14161a;
	display: inline-block;
	flex: 0 0 auto;
	font-size: 0.76em;
	padding: 0.1em 0.55em;
}

.dzm-bar--clickable {
	cursor: pointer;
}

/* ------------------------------------------------------------------
 * Označení programů se vstupenkou
 * ------------------------------------------------------------------ */

.dzm-ticket-badge {
	align-items: center;
	display: inline-flex;
	flex: 0 0 auto;
	gap: 0.35em;
}

/*
 * Když šablona nemá načtený Font Awesome, vykreslí se místo ikony
 * jednoduchá vstupenka v barvě textu, aby označení nezmizelo.
 */
.dzm--no-fa .dzm-ticket {
	background-color: currentColor;
	display: inline-block;
	height: 1em;
	-webkit-mask: var(--dzm-ticket-mask) center / contain no-repeat;
	mask: var(--dzm-ticket-mask) center / contain no-repeat;
	vertical-align: -0.125em;
	width: 1.15em;
}

.dzm-timeline {
	--dzm-ticket-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 20'%3E%3Cpath d='M1 5.5a1.5 1.5 0 0 1 1.5-1.5h23a1.5 1.5 0 0 1 1.5 1.5v2.2a2.3 2.3 0 0 0 0 4.6v2.2a1.5 1.5 0 0 1-1.5 1.5h-23A1.5 1.5 0 0 1 1 14.5v-2.2a2.3 2.3 0 0 0 0-4.6V5.5Z'/%3E%3C/svg%3E");
}

.dzm-bar .dzm-ticket-badge {
	font-size: 0.95em;
}

.dzm-card .dzm-ticket-badge {
	background: rgba(255, 255, 255, 0.92);
	border-radius: 999px;
	color: #14161a;
	font-size: 0.8em;
	font-weight: 700;
	padding: 0.15em 0.6em;
}

.dzm-timeline__note .dzm-ticket,
.dzm-modal__ticket .dzm-ticket {
	margin-right: 0.15em;
}

.dzm-modal__ticket {
	align-items: center;
	color: var(--dzm-modal-accent, #7c3aed);
	display: flex;
	font-weight: 700;
	gap: 0.4em;
	margin: 0.4em 0 0;
}

.dzm-modal__ticket[hidden] {
	display: none;
}

.dzm-bar--clickable:hover,
.dzm-bar--clickable:focus-visible {
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
	transform: translateY(-1px);
}

.dzm-bar--clickable:focus-visible {
	outline: 2px solid var(--dzm-text);
	outline-offset: 2px;
}

.dzm-gantt__hint {
	color: var(--dzm-muted);
	font-size: 0.82em;
	margin: 0.5em 0 0;
}

/* ------------------------------------------------------------------
 * Seznam (mobil)
 * ------------------------------------------------------------------ */

.dzm-timeline__list {
	display: none;
}

.dzm-list-group {
	margin: 0 0 1.4rem;
}

.dzm-list-group__title {
	border-bottom: 2px solid var(--dzm-border);
	font-size: 1.1em;
	font-weight: 700;
	margin: 0 0 0.6rem;
	padding-bottom: 0.25rem;
}

.dzm-list {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.dzm-list__item {
	margin: 0;
	padding: 0;
}

.dzm-card {
	background: var(--dzm-bar, #7c3aed);
	border: 0;
	border-radius: var(--dzm-radius);
	color: var(--dzm-bar-text, #fff);
	display: flex;
	flex-direction: column;
	font: inherit;
	gap: 0.35rem;
	padding: 0.85rem 1rem;
	text-align: left;
	width: 100%;
}

.dzm-card--clickable {
	cursor: pointer;
}

.dzm-card--clickable:hover,
.dzm-card--clickable:focus-visible {
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.dzm-card--clickable:focus-visible {
	outline: 2px solid var(--dzm-text);
	outline-offset: 2px;
}

.dzm-card__meta {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.dzm-card__time {
	background: rgba(255, 255, 255, 0.92);
	border-radius: 999px;
	color: #14161a;
	font-size: 0.8em;
	font-weight: 700;
	padding: 0.15em 0.6em;
	white-space: nowrap;
}

.dzm-card__cat {
	font-size: 0.8em;
	opacity: 0.9;
	text-transform: uppercase;
}

.dzm-card__title {
	font-size: 1.02em;
	font-weight: 700;
}

.dzm-card__place {
	font-size: 0.88em;
	opacity: 0.92;
}

.dzm-card__more {
	font-size: 0.82em;
	opacity: 0.9;
	text-decoration: underline;
}

/* ------------------------------------------------------------------
 * Přepínání zobrazení
 * ------------------------------------------------------------------ */

@media (max-width: 781px) {
	.dzm-timeline__gantt-wrap {
		display: none;
	}

	.dzm-timeline__list {
		display: block;
	}
}

/* Se zapnutým JS rozhoduje šířka kontejneru, ne celého okna. */
.dzm-timeline.dzm--js .dzm-timeline__gantt-wrap {
	display: block;
}

.dzm-timeline.dzm--js .dzm-timeline__list {
	display: none;
}

.dzm-timeline.dzm--js.dzm--stack .dzm-timeline__gantt-wrap {
	display: none;
}

.dzm-timeline.dzm--js.dzm--stack .dzm-timeline__list {
	display: block;
}

/* Posuvník je potřeba jen tehdy, když se graf nevejde. */
.dzm-timeline.dzm--js:not(.dzm--scrollable) .dzm-gantt__hint {
	display: none;
}

/* ------------------------------------------------------------------
 * Modální okno
 * ------------------------------------------------------------------ */

.dzm-modal[hidden] {
	display: none;
}

.dzm-modal {
	align-items: center;
	display: flex;
	inset: 0;
	justify-content: center;
	padding: 1rem;
	position: fixed;
	z-index: 100000;
}

.dzm-modal__overlay {
	background: rgba(10, 12, 16, 0.62);
	inset: 0;
	position: absolute;
}

.dzm-modal__dialog {
	animation: dzm-modal-in 0.16s ease-out;
	background: var(--dzm-bg);
	border-radius: 12px;
	box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
	color: var(--dzm-text);
	max-height: min(86vh, 900px);
	max-width: 680px;
	overflow-y: auto;
	padding: 1.6rem;
	position: relative;
	width: 100%;
}

@keyframes dzm-modal-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.dzm-modal__dialog {
		animation: none;
	}

	.dzm-bar {
		transition: none;
	}

	.dzm-bar__text {
		transition: none;
	}
}

.dzm-modal__close {
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: var(--dzm-text);
	cursor: pointer;
	font-size: 1.7rem;
	height: 2.2rem;
	line-height: 1;
	position: absolute;
	right: 0.7rem;
	top: 0.7rem;
	width: 2.2rem;
}

.dzm-modal__close:hover,
.dzm-modal__close:focus-visible {
	background: rgba(0, 0, 0, 0.08);
}

.dzm-modal__head {
	border-bottom: 1px solid var(--dzm-line);
	margin-bottom: 1rem;
	padding-bottom: 0.9rem;
	padding-right: 2rem;
}

.dzm-modal__cat {
	color: var(--dzm-modal-accent, #7c3aed);
	font-size: 0.8em;
	font-weight: 700;
	letter-spacing: 0.04em;
	margin: 0 0 0.3em;
	text-transform: uppercase;
}

.dzm-modal__title {
	font-size: 1.4em;
	line-height: 1.25;
	margin: 0 0 0.35em;
}

.dzm-modal__time {
	font-weight: 700;
	margin: 0;
}

.dzm-modal__place {
	color: var(--dzm-muted);
	margin: 0.25em 0 0;
}

.dzm-modal__body {
	overflow-wrap: anywhere;
}

.dzm-modal__body > *:first-child {
	margin-top: 0;
}

.dzm-modal__body > *:last-child {
	margin-bottom: 0;
}

.dzm-modal__body img {
	height: auto;
	max-width: 100%;
}

.dzm-modal__link {
	display: inline-block;
	font-weight: 700;
	margin-top: 0.5rem;
}

body.dzm-modal-open {
	overflow: hidden;
}

/* Skrytý text pro odečítače obrazovky (kdyby ho šablona neměla). */
.dzm-timeline .screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* ------------------------------------------------------------------
 * Obrana proti stylům šablony
 *
 * Timeline se vkládá do cizí stránky, kde šablona běžně styluje
 * tlačítka a seznamy v obsahu – a její styly se navíc načítají až
 * po stylech pluginu. Vlastnosti, na kterých stojí vzhled timeline,
 * proto zamykáme.
 * ------------------------------------------------------------------ */

html {
	/*
	 * Bez tohoto nafukuje iOS Safari velikost písma podle šířky obsahu,
	 * a to i v textech nad vloženou timeline. Styly pluginu se načítají
	 * jen na stránkách se shortcodem.
	 */
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

/* Seznam programů nesmí mít odrážky ani odsazení po šabloně. */
.dzm-timeline .dzm-list,
.dzm-timeline .dzm-list__item {
	list-style: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

.dzm-timeline .dzm-list__item::marker {
	content: "" !important;
}

/* Některé šablony kreslí odrážku pseudo-prvkem. */
.dzm-timeline .dzm-list__item::before {
	content: none !important;
}

/* Bloky programu vypadají stejně, ať jsou klikací (button), nebo ne (div). */
.dzm-timeline .dzm-bar,
.dzm-timeline .dzm-card {
	border-radius: var(--dzm-radius) !important;
	font-family: inherit !important;
	font-size: inherit !important;
	letter-spacing: normal !important;
	min-height: 0 !important;
	text-decoration: none !important;
	text-transform: none !important;
}

.dzm-timeline .dzm-bar {
	padding: 0 0.6em !important;
}

.dzm-timeline .dzm-card {
	padding: 0.85rem 1rem !important;
	text-align: left !important;
	width: 100% !important;
}
