/*
 * Jeden Tag ein Set – main stylesheet
 * No framework, no build step: custom properties, native nesting, grid,
 * container queries and logical properties.
 */

/* ------------------------------------------------------------------ tokens */

:root {
	--accent: #d28549;
	--accent-dark: #b86d33;
	--text: #666;
	--text-strong: #333;
	--heading: #222;
	--muted: #999;
	--line: #dfdfdf;
	--paper: #fff;
	--page-bg: #313131; /* main tone of the pattern tile */

	--font-sans: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-condensed: "Open Sans Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;

	--frame: 2px solid var(--accent);
	--shadow: 5px 5px 20px #000;

	--container: 980px;
	--gutter: 16px;
	--gap: 20px;
	--section-gap: 25px;

	/* the original 46 × 29 cube tile, shown at 1:1 */
	--pattern: url("../images/background-pattern.png");
}

/* ------------------------------------------------------------------- base */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-block-start: 1rem;
}

body {
	margin: 0;
	min-block-size: 100vh;
	font: 400 14px/1.3 var(--font-sans);
	color: var(--text);
	background: var(--page-bg) var(--pattern) 0 0 / 46px 29px repeat fixed;
	overflow-x: clip;
}

img,
svg,
iframe {
	display: block;
	max-inline-size: 100%;
}

img {
	block-size: auto;
}

a {
	color: inherit;
	text-decoration: none;
	transition: color 0.15s ease;
}

button,
input {
	font: inherit;
	color: inherit;
}

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

.visually-hidden {
	position: absolute !important;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.skip-link {
	position: absolute;
	inset-block-start: 0;
	inset-inline-start: 0;
	z-index: 100;
	padding: 10px 16px;
	background: var(--paper);
	color: var(--heading);
	font-weight: 600;
	translate: 0 -120%;

	&:focus {
		translate: 0 0;
	}
}

/* white framed box used everywhere */
.box {
	background: var(--paper);
	border: var(--frame);
	box-shadow: var(--shadow);
}

.button {
	display: inline-block;
	padding: 8px 24px;
	border: var(--frame);
	background: var(--paper);
	color: var(--text-strong);
	font: 700 18px/24px var(--font-condensed);
	letter-spacing: 1px;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;

	&:hover,
	&:focus-visible {
		background: var(--accent);
		color: #fff;
	}
}

.button--accent {
	background: var(--accent);
	color: #fff;

	&:hover,
	&:focus-visible {
		background: var(--accent-dark);
	}
}

.chips,
.tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.chip {
	display: inline-block;
	padding: 3px 10px;
	border: 1px solid var(--accent);
	color: var(--text-strong);
	font: 300 14px/20px var(--font-condensed);
	letter-spacing: 1px;
	text-transform: uppercase;

	&:hover,
	&:focus-visible {
		background: var(--accent);
		color: #fff;
	}
}

.notice {
	margin-block: var(--gap) 0;
	padding: 20px 25px;
	background: var(--paper);
	border: var(--frame);
	box-shadow: var(--shadow);
	font-size: 16px;
	text-align: center;
}

/* ----------------------------------------------------------------- layout */

.site {
	inline-size: min(var(--container), 100% - 2 * var(--gutter));
	margin-inline: auto;
}

.site-header {
	padding-block-start: 20px;
}

.site-main {
	outline: none;
}

.site-footer {
	margin-block: 40px 30px;
	color: var(--muted);
	font-size: 13px;
	text-align: center;

	& p {
		margin: 0;
	}

	& a:hover {
		color: var(--accent);
	}
}

/* ------------------------------------------------------------------- logo */

.brand {
	display: block;
	inline-size: fit-content;
	max-inline-size: 100%;
}

.brand__logo {
	display: block;
	inline-size: auto;
	max-inline-size: 100%;
	block-size: 106px;
	object-fit: contain;
}

/* ------------------------------------------------------------------- menu */

.menu {
	position: relative;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-block-start: 24px;
	padding: 15px 10px;
	background: var(--paper);
	border: var(--frame);
	box-shadow: var(--shadow);
}

.menu__toggle {
	display: none;
}

.menu__list,
.menu__sub {
	margin: 0;
	padding: 0;
	list-style: none;
}

.menu__list {
	display: flex;
	gap: 38px;
	padding-inline-start: 15px;
}

.menu__item {
	position: relative;
}

.menu__link {
	display: block;
	color: var(--text-strong);
	font: 300 16px/22px var(--font-condensed);
	letter-spacing: 2px;
	text-transform: uppercase;
	white-space: nowrap;

	&:hover,
	&:focus-visible,
	&[aria-current="page"] {
		color: var(--accent);
	}
}

.menu__item.is-open > .menu__link {
	color: var(--accent);
}

.menu__sub-toggle {
	display: none;
}

.menu__sub {
	position: absolute;
	z-index: 1;
	min-inline-size: 210px;
	padding-block: 6px;
	background: var(--paper);
	border: 1px solid var(--line);
	box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
	visibility: hidden;
	opacity: 0;
	translate: 0 6px;
	transition: opacity 0.15s ease, translate 0.15s ease, visibility 0s linear 0.15s;

	& .menu__link {
		padding: 8px 16px;
		font-size: 14px;
		line-height: 18px;
	}

	& .menu__link:hover,
	& .menu__link:focus-visible {
		background: #f6f6f6;
	}

	/* hint that there is a flyout */
	& .has-sub > .menu__link {
		display: flex;
		justify-content: space-between;
		gap: 12px;

		&::after {
			content: "›";
			color: var(--muted);
		}
	}
}

/* second level drops down from the bar, third level flies out sideways */
.menu__sub--level-2 {
	inset-block-start: calc(100% + 17px);
	inset-inline-start: -16px;
}

.menu__sub--level-3 {
	inset-block-start: -7px;
	inset-inline-start: 100%;
}

/* keep the dropdown open while the pointer travels from the bar */
.menu__item--level-1.has-sub::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	inset-block-start: 100%;
	block-size: 20px;
}

.has-sub:hover > .menu__sub,
.has-sub:focus-within > .menu__sub,
.menu__sub-toggle[aria-expanded="true"] + .menu__sub {
	visibility: visible;
	opacity: 1;
	translate: 0 0;
	transition-delay: 0s;
}

/* ----------------------------------------------------------------- social */

.social {
	display: flex;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.social__link {
	display: block;
	border-radius: 3px;

	& .social__icon > rect:first-child {
		transition: fill 0.15s ease;
	}

	&:hover .social__icon > rect:first-child,
	&:focus-visible .social__icon > rect:first-child {
		fill: var(--accent);
	}
}

/* uploaded icons keep their own design, just the badge size */
.social__icon--file {
	inline-size: 22px;
	block-size: 22px;
	object-fit: contain;
	transition: opacity 0.15s ease;

	.social__link:hover &,
	.social__link:focus-visible & {
		opacity: 0.75;
	}
}

/* --------------------------------------------------------------- home row */

.intro-row {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--gap);
	margin-block-start: var(--section-gap);
}

.slider {
	position: relative;
	grid-column: span 2;
	container: slider / inline-size;
	background: var(--paper);
	border: var(--frame);
	box-shadow: var(--shadow);
	min-inline-size: 0;
}

.slider__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 100%;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;

	&::-webkit-scrollbar {
		display: none;
	}

	&:focus-visible {
		outline-offset: -4px;
	}
}

.slider__slide {
	scroll-snap-align: start;
	scroll-snap-stop: always;
	min-inline-size: 0;
}

.slider__media img {
	inline-size: 100%;
	aspect-ratio: 642 / 303;
	object-fit: cover;
	background: #111;
}

.slider__title {
	margin: 0;
	padding: 8px 10px;
	font: 300 20px/23px var(--font-condensed);
	text-transform: uppercase;
	color: var(--heading);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;

	& a:hover,
	& a:focus-visible {
		color: var(--accent);
	}
}

.slider__button {
	position: absolute;
	/* vertically centred on the image: half of the image height minus half the button */
	inset-block-start: calc(100cqi * 303 / 642 / 2 - 19px);
	display: grid;
	place-items: center;
	inline-size: 38px;
	block-size: 38px;
	padding: 0;
	border: 0;
	background: rgb(0 0 0 / 0.6);
	color: #fff;
	cursor: pointer;
	transition: background-color 0.15s ease;

	&:hover,
	&:focus-visible {
		background: rgb(0 0 0 / 0.85);
	}

	&[hidden] {
		display: none;
	}
}

.slider__button--prev {
	inset-inline-start: 0;
}

.slider__button--next {
	inset-inline-end: 0;
}

.about {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 25px;
	font-size: 16px;
	line-height: 20px;
	text-align: center;

	& p {
		margin: 0 0 20px;
	}

	& > :last-child {
		margin-block-end: 0;
	}

	& a {
		color: var(--accent);
	}
}

.about__slogan {
	font-weight: 700;
}

/* ------------------------------------------------------------------ cards */

.cards {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--gap);
	margin-block-start: var(--gap);
}

.card {
	container: card / inline-size;
	display: grid;
	grid-template-rows: auto 1fr;
	min-block-size: 345px;
	background: var(--paper);
	border: var(--frame);
	box-shadow: var(--shadow);

	/* fade in cards appended by "Mehr laden" */
	&.is-new {
		animation: card-in 0.4s ease both;
	}
}

@keyframes card-in {
	from {
		opacity: 0;
		translate: 0 12px;
	}
}

.card__media {
	display: block;
	overflow: hidden;

	& img {
		inline-size: 100%;
		aspect-ratio: 309 / 196;
		object-fit: cover;
		background: #111;
		transition: scale 0.4s ease;
	}
}

.card:has(a:hover) .card__media img {
	scale: 1.04;
}

.card__body {
	padding: 5px 10px 12px;
	text-align: center;
}

.card__title {
	min-block-size: 2lh;
	margin: 5px 0 10px;
	font: 300 20px/25px var(--font-condensed);
	text-transform: uppercase;
	color: var(--heading);
	overflow-wrap: anywhere;

	& a:hover,
	& a:focus-visible {
		color: var(--accent);
	}
}

.card__excerpt {
	display: -webkit-box;
	margin: 0;
	font-size: 14px;
	line-height: 18px;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

/* narrow cards (e.g. three columns on a small laptop) */
@container card (width < 280px) {
	.card__title {
		font-size: 18px;
		line-height: 22px;
	}
}

/* wide single-column cards on phones: a bit more room */
@container card (width > 440px) {
	.card__body {
		padding-inline: 20px;
	}
}

.load-more {
	display: flex;
	justify-content: center;
	margin-block-start: 32px;
}

.load-more__button[aria-busy="true"] {
	opacity: 0.6;
	pointer-events: none;
}

/* --------------------------------------------------------- listing header */

.listing-header {
	margin-block-start: var(--section-gap);
	padding: 20px 25px;

	& .search-form {
		margin-block-start: 15px;
		max-inline-size: 480px;
	}

	& .search-form__label {
		display: none;
	}

	& .chips {
		margin-block-start: 12px;
	}
}

.listing-header__title {
	margin: 0;
	font: 300 28px/1.2 var(--font-condensed);
	letter-spacing: 2px;
	text-transform: uppercase;
	color: var(--heading);
}

.listing-header__intro {
	margin-block-start: 6px;
	font-size: 16px;

	& p {
		margin: 0;
	}
}

/* ------------------------------------------------- article / generic page */

.page-box {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 265px;
	gap: 19px;
	margin-block-start: var(--section-gap);
	padding: 25px;
	background: var(--paper);
	border: var(--frame);
	box-shadow: var(--shadow);
}

.page-box__content {
	min-inline-size: 0;
	padding-inline-end: 3px;
}

.post__title {
	margin: -4px 0 2px;
	font-size: 23px;
	font-weight: 400;
	line-height: 1.2;
	color: var(--text);
}

.post__meta {
	margin: 0 0 15px;
	font-size: 12px;

	& b {
		font-weight: 600;
	}

	& a {
		color: var(--accent);
	}

	&:has(+ .post__facts) {
		margin-block-end: 4px;
	}
}

/* set number, artist, location and date as one dotted row */
.post__facts {
	display: flex;
	flex-wrap: wrap;
	margin: 0 0 15px;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-strong);

	& > div {
		display: flex;
	}

	& > div + div::before {
		content: "·" / "";
		margin-inline: 6px;
		font-weight: 400;
		color: var(--muted);
	}

	& dd {
		margin: 0;
	}

	& a {
		color: var(--accent);

		&:hover {
			color: var(--accent-dark);
		}
	}
}

.post__cover {
	margin: 0 0 20px;

	& img {
		inline-size: 100%;
	}
}

.text {
	font-size: 16px;
	line-height: 20px;
	color: var(--text-strong);

	& p,
	& ul,
	& ol {
		margin: 0 0 15px;
	}

	& h2 {
		margin: 25px 0 8px;
		font-size: 19px;
		font-weight: 600;
		color: var(--text-strong);
	}

	& strong,
	& b {
		font-weight: 700;
	}

	& a {
		color: var(--accent);
		text-decoration: underline;
		text-decoration-thickness: 1px;
		text-underline-offset: 2px;

		&:hover {
			color: var(--accent-dark);
		}
	}
}

.post__credits {
	margin: 30px 0 0;
	font-size: 16px;
	color: var(--text-strong);

	& span {
		color: var(--text);
	}
}

.post .tags {
	margin-block-start: 15px;
}

/* click-to-load player */
.embed {
	position: relative;
	margin: 30px 0 0;
	min-block-size: 450px;
	background: #1d1d1d var(--pattern) 0 0 / 46px 29px;
	color: #ddd;

	& iframe {
		inline-size: 100%;
		block-size: 450px;
		border: 0;
	}

	&.is-loaded {
		background: none;
	}
}

/* players inside the article text, see the (embed: …) KirbyTag */
.text .embed {
	margin: 20px 0;
}

.embed__placeholder {
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 14px;
	min-block-size: 450px;
	padding: 30px;
	text-align: center;

	& p {
		margin: 0;
		max-inline-size: 42ch;
	}

	& .button[hidden] {
		display: none;
	}
}

.embed__provider {
	font: 700 22px/1 var(--font-condensed);
	letter-spacing: 2px;
	text-transform: uppercase;
	color: #fff;
}

.embed__link {
	color: var(--accent);
	font-size: 13px;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* previous / next */
.post-nav {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 40px;
	margin-block-start: 60px;
	font-size: 14px;
	line-height: 18px;
}

.post-nav__link {
	position: relative;
	display: grid;
	align-content: start;
	padding-inline-start: 25px;

	/* thin chevron */
	&::before {
		content: "";
		position: absolute;
		inset-block-start: 50%;
		inset-inline-start: 6px;
		inline-size: 16px;
		block-size: 16px;
		border-block-end: 1px solid #c9c9c9;
		border-inline-start: 1px solid #c9c9c9;
		translate: 0 -50%;
		rotate: 45deg;
		transition: border-color 0.15s ease;
	}

	&:hover::before,
	&:focus-visible::before {
		border-color: var(--accent);
	}

	&:hover .post-nav__title {
		color: var(--accent);
	}
}

.post-nav__link--next {
	grid-column: 2;
	padding-inline: 0 25px;
	text-align: end;

	&::before {
		inset-inline: auto 6px;
		rotate: -135deg;
	}
}

.post-nav__label {
	font-size: 13px;
	font-style: italic;
	color: var(--muted);
}

/* ------------------------------------------------------------ search form */

.search-form__label {
	display: block;
	margin-block: -4px 12px;
	font-size: 16px;
	font-weight: 600;
}

.search-form__row {
	display: flex;
}

.search-form__input {
	flex: 1;
	min-inline-size: 0;
	block-size: 38px;
	padding: 0 10px;
	border: 1px solid #ccc;
	border-inline-end: 0;
	border-radius: 0;
	background: #fff;
	color: var(--text-strong);

	&:focus-visible {
		outline: none;
		border-color: var(--accent);
	}
}

.search-form__button {
	flex: none;
	block-size: 38px;
	padding: 0 15px;
	border: 0;
	background: var(--accent);
	color: #fff;
	font: 700 14px/38px var(--font-condensed);
	letter-spacing: 1px;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.15s ease;

	&:hover,
	&:focus-visible {
		background: var(--accent-dark);
	}
}

/* ------------------------------------------------------------- responsive */

@media (width < 1020px) {
	:root {
		--section-gap: 20px;
	}

	.site-header {
		padding-block-start: 16px;
	}


	.brand__logo {
		block-size: clamp(48px, 14vw, 90px);
	}

	.menu {
		flex-wrap: wrap;
		margin-block-start: 16px;
		padding: 10px;
	}

	.menu__toggle:not([hidden]) {
		display: inline-flex;
		align-items: center;
		gap: 10px;
		padding: 4px 6px;
		border: 0;
		background: none;
		color: var(--text-strong);
		font: 300 16px/22px var(--font-condensed);
		letter-spacing: 2px;
		text-transform: uppercase;
		cursor: pointer;
	}

	.menu__burger,
	.menu__burger::before,
	.menu__burger::after {
		display: block;
		inline-size: 20px;
		block-size: 2px;
		background: currentColor;
		transition: rotate 0.2s ease, translate 0.2s ease, opacity 0.2s ease;
	}

	.menu__burger {
		position: relative;

		&::before,
		&::after {
			content: "";
			position: absolute;
		}

		&::before {
			translate: 0 -6px;
		}

		&::after {
			translate: 0 6px;
		}
	}

	.menu__toggle[aria-expanded="true"] .menu__burger {
		background: transparent;

		&::before {
			translate: 0 0;
			rotate: 45deg;
		}

		&::after {
			translate: 0 0;
			rotate: -45deg;
		}
	}

	.social {
		order: 2;
		margin-inline-start: auto;
	}

	.menu__list {
		order: 3;
		flex-basis: 100%;
		flex-direction: column;
		gap: 0;
		padding: 0;
	}

	/* with JS the list is collapsed until the toggle opens it */
	.menu.is-enhanced:not(.is-open) .menu__list {
		display: none;
	}

	.menu__item {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		border-block-start: 1px solid #eee;
	}

	.menu__item--level-1:first-child {
		margin-block-start: 10px;
	}

	.menu__link,
	.menu__sub .menu__link {
		padding: 10px 6px;
		font-size: 16px;
		line-height: 22px;
		white-space: normal;
	}

	.menu.is-enhanced .menu__sub-toggle {
		display: grid;
		place-items: center;
		inline-size: 44px;
		block-size: 42px;
		padding: 0;
		border: 0;
		background: none;
		color: var(--text-strong);
		cursor: pointer;

		& svg {
			transition: rotate 0.2s ease;
		}

		&[aria-expanded="true"] svg {
			rotate: 180deg;
		}
	}

	.menu__sub,
	.menu__sub--level-2,
	.menu__sub--level-3 {
		position: static;
		grid-column: 1 / -1;
		min-inline-size: 0;
		padding: 0 0 0 16px;
		border: 0;
		box-shadow: none;
		visibility: visible;
		opacity: 1;
		translate: none;
		transition: none;

		& .has-sub > .menu__link::after {
			content: none;
		}
	}

	.menu.is-enhanced .menu__sub {
		display: none;
	}

	.menu.is-enhanced .menu__sub-toggle[aria-expanded="true"] + .menu__sub {
		display: block;
	}

	.menu__item--level-1.has-sub::after {
		content: none;
	}

	.intro-row {
		grid-template-columns: minmax(0, 1fr);
	}

	.slider {
		grid-column: auto;
	}

	.cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.card {
		min-block-size: 0;
	}

	.page-box {
		grid-template-columns: minmax(0, 1fr);
		gap: 30px;
		padding: 16px;
	}

	.page-box__sidebar {
		padding-block-start: 20px;
		border-block-start: 1px solid #eee;
	}
}

@media (width < 640px) {
	.cards {
		grid-template-columns: minmax(0, 1fr);
	}

	.slider__title {
		font-size: 18px;
	}

	.card__title {
		min-block-size: 0;
	}

	.about {
		padding: 20px;
	}

	.listing-header {
		padding: 16px;
	}

	.post-nav {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
		margin-block-start: 40px;
	}

	.post-nav__link--next {
		grid-column: 1;
	}

	.embed,
	.embed__placeholder {
		min-block-size: 320px;
	}
}

@media (width < 400px) {
	.social {
		gap: 5px;
	}
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
