/*
Theme Name:        RKF – Regionalna Kronika Filmowa
Description:       Motyw Regionalnej Kroniki Filmowej (CEiIK Olsztyn) według projektu „Archiwum RKF v2”: typ wpisu „Film” z kategoriami, latami i tagami, lista filmów z filtrami, strona filmu z odtwarzaczem, przekierowania ze starych adresów kroniki.
Version:           2.0.0
Requires at least: 6.0
Requires PHP:      7.4
Author:            CEiIK Olsztyn
License:           GNU General Public License v2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       rkf
*/

/* ---------------------------------------------------------------
   Font: Work Sans (variable, weight 100–900), SIL OFL 1.1 – assets/fonts/OFL.txt
---------------------------------------------------------------- */
@font-face {
	font-family: "Work Sans";
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url("assets/fonts/work-sans-latin-wght-normal.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Work Sans";
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url("assets/fonts/work-sans-latin-ext-wght-normal.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------
   Tokens (from the design). Phones first; tablet from 40em (640 px), desktop from 64em (1024 px).
   Font sizes are in rem (1rem = 16 px), so they follow the browser's text size and the size chosen in
   Ułatwienia dostępu. The high contrast mode at the end of the file redefines the colours below.
---------------------------------------------------------------- */
:root {
	--rkf-bg: #faf9f6;
	--rkf-paper: #ffffff;
	--rkf-text: #25241f;
	--rkf-text-2: #3b3a33;
	--rkf-muted: #6b6a60;
	--rkf-meta: #75736a;       /* design: #8a887c, darkened to 4.5:1 for small text */
	--rkf-disabled: #b9b6aa;
	--rkf-line: #e4e1d8;       /* dividers */
	--rkf-edge: #d6d2c6;       /* borders of fields, chips, buttons */
	--rkf-accent: #7a5418;
	--rkf-accent-dark: #4f3610;
	--rkf-accent-soft: #efe7d6;
	--rkf-hover: #efece4;
	--rkf-on-fill: #fff;       /* text on filled buttons and chips */
	--rkf-focus: var(--rkf-accent);
	--rkf-focus-width: 2px;
	--rkf-stripes: repeating-linear-gradient(135deg, #e3dfd4 0 8px, #dcd7ca 8px 16px);
	--rkf-font: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--rkf-max: 1280px;
}

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

html {
	font-size: 100%;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

/* Ułatwienia dostępu → Rozmiar tekstu. */
html[data-rkf-text="125"] {
	font-size: 125%;
}

html[data-rkf-text="150"] {
	font-size: 150%;
}

body {
	margin: 0;
	background: var(--rkf-bg);
	color: var(--rkf-text);
	font-family: var(--rkf-font);
	font-size: 1rem;
	line-height: 1.5;
}

img,
video {
	display: block;
	max-width: 100%;
	height: auto;
}

a {
	color: var(--rkf-accent);
	text-decoration: none;
}

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

h1,
h2,
h3,
p {
	margin: 0;
}

button,
input {
	font: inherit;
}

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

::selection {
	background: var(--rkf-accent-soft);
	color: var(--rkf-text);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed !important;
	top: 8px;
	left: 8px;
	z-index: 100;
	width: auto;
	height: auto;
	margin: 0;
	padding: 10px 16px;
	clip: auto;
	background: var(--rkf-text);
	color: var(--rkf-on-fill);
}

/* ---------------------------------------------------------------
   Labels and chips
---------------------------------------------------------------- */
.rkf-label {
	margin-bottom: 12px;
	color: var(--rkf-meta);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.rkf-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rkf-chip {
	display: inline-flex;
	align-items: center;
	padding: 4px 9px;
	color: var(--rkf-text-2);
	font-size: 0.8125rem;
	line-height: 1.4;
	border: 1px solid var(--rkf-edge);
}

a.rkf-chip:hover {
	color: var(--rkf-text);
	border-color: var(--rkf-text-2);
}

.rkf-chip.is-on,
a.rkf-chip.is-on:hover {
	color: var(--rkf-on-fill);
	background: var(--rkf-accent);
	border-color: var(--rkf-accent);
}

.rkf-chip.is-disabled {
	color: var(--rkf-disabled);
	border-color: var(--rkf-line);
}

.rkf-chips--big,
.rkf-chips--film {
	gap: 8px;
}

.rkf-chips--big .rkf-chip,
.rkf-chips--film .rkf-chip {
	min-height: 40px;
	padding: 0 12px;
	font-size: 0.875rem;
}

/* ---------------------------------------------------------------
   Header
---------------------------------------------------------------- */
.rkf-header {
	position: sticky;
	top: 0;
	z-index: 20;
	background: var(--rkf-bg);
	border-bottom: 1px solid var(--rkf-line);
}

/* Logged-in users: WordPress keeps its admin bar fixed only above 600 px; below that it scrolls away with the page. */
@media (min-width: 601px) {
	.admin-bar .rkf-header {
		top: var(--wp-admin--admin-bar--height, 32px);
	}
}

.rkf-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	max-width: var(--rkf-max);
	margin: 0 auto;
	padding: 12px 16px;
}

.rkf-logo {
	display: block;
	flex: none;
}

.rkf-logo img {
	width: auto;
	height: 44px;
}

.rkf-back {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-left: -10px;
	color: var(--rkf-text);
	font-size: 1.375rem;
}

.rkf-header__tools {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}

.rkf-icon-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 0;
	color: var(--rkf-text);
	font: 700 1.25rem/1 Helvetica, Arial, sans-serif;
	background: var(--rkf-paper);
	border: 1px solid var(--rkf-edge);
	cursor: pointer;
}

.rkf-icon-btn:hover,
.rkf-menu-btn[aria-expanded="true"],
.rkf-a11y-btn[aria-expanded="true"] {
	color: var(--rkf-on-fill);
	background: var(--rkf-text);
	border-color: var(--rkf-text);
}

.rkf-menu-btn span {
	display: block;
	width: 18px;
	height: 2px;
	background: currentColor;
}

.rkf-menu-btn[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.rkf-menu-btn[aria-expanded="true"] span:nth-child(2) {
	opacity: 0;
}

.rkf-menu-btn[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

.no-js .rkf-menu-btn,
.single-rkf_film .rkf-menu-btn {
	display: none;
}

/* On phones the menu opens as a list under the header bar. */
.rkf-nav {
	flex: 0 0 calc(100% + 32px); /* full width: the header has 16 px padding on each side */
	order: 10;
	margin: 12px -16px -12px;
	border-top: 1px solid var(--rkf-line);
}

.js .rkf-nav:not(.is-open) {
	display: none;
}

.rkf-nav ul {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rkf-nav a {
	display: block;
	padding: 14px 16px;
	color: var(--rkf-muted);
	font-size: 1rem;
	font-weight: 500;
	border-left: 3px solid transparent;
}

.rkf-nav a:hover {
	color: var(--rkf-text);
}

.rkf-nav .current-menu-item > a,
.rkf-nav a[aria-current="page"] {
	color: var(--rkf-text);
	border-left-color: var(--rkf-accent);
}

/* ---------------------------------------------------------------
   Ułatwienia dostępu: the header button and its panel (template-parts/accessibility.php).
   The modes it switches on are at the end of the file.
---------------------------------------------------------------- */
.rkf-a11y-btn svg {
	width: 26px;
	height: 26px;
}

.no-js .rkf-a11y-btn {
	display: none;
}

/* Phones: full width under the sticky header bar; scrolls on its own when taller than the screen. */
.rkf-a11y {
	position: absolute;
	top: calc(100% + 1px);
	right: 0;
	left: 0;
	z-index: 30;
	display: flex;
	flex-direction: column;
	gap: 20px;
	max-height: calc(100vh - 69px);
	max-height: calc(100dvh - 69px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 20px 16px 24px;
	color: var(--rkf-text);
	background: var(--rkf-bg);
	border-bottom: 1px solid var(--rkf-edge);
	box-shadow: 0 16px 32px rgba(37, 36, 31, 0.16);
}

.rkf-a11y[hidden] {
	display: none;
}

.rkf-a11y__group {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.rkf-a11y__group legend {
	padding: 0;
}

.rkf-a11y__options {
	display: flex;
	gap: 8px;
}

.rkf-a11y__option {
	position: relative;
	display: flex;
	flex: 1 1 0;
	min-width: 0;
}

/* The real radio button covers the whole option, so clicks, taps and screen reader touch all land on it. */
.rkf-a11y__option input {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.rkf-a11y__face {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	gap: 6px;
	min-height: 72px;
	padding: 10px 4px 8px;
	color: var(--rkf-text-2);
	font-size: 0.875rem;
	line-height: 1.3;
	text-align: center;
	background: var(--rkf-paper);
	border: 1px solid var(--rkf-edge);
}

.rkf-a11y__option:hover .rkf-a11y__face {
	color: var(--rkf-text);
	border-color: var(--rkf-text-2);
}

.rkf-a11y__option input:checked + .rkf-a11y__face {
	color: var(--rkf-on-fill);
	background: var(--rkf-text);
	border-color: var(--rkf-text);
}

.rkf-a11y__option input:focus-visible + .rkf-a11y__face {
	outline: var(--rkf-focus-width) solid var(--rkf-focus);
	outline-offset: 2px;
}

/* "A" growing like the text: 18, 22.5 and 27 px at the normal size. */
.rkf-a11y__sample {
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1;
}

.rkf-a11y__sample--125 {
	font-size: 1.40625rem;
}

.rkf-a11y__sample--150 {
	font-size: 1.6875rem;
}

/* Previews of the two colour schemes: fixed colours in either mode. */
.rkf-a11y__swatch {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 1.75rem;
	color: #25241f;
	font-size: 0.9375rem;
	font-weight: 600;
	background: #faf9f6;
	border: 1px solid #d6d2c6;
	forced-color-adjust: none;
}

.rkf-a11y__swatch--high {
	color: #ff0;
	background: #000;
	border-color: #000;
}

.rkf-a11y__check {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	color: var(--rkf-text);
	font-size: 0.9375rem;
	line-height: 1.35;
	cursor: pointer;
}

.rkf-a11y__check input {
	flex: none;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0;
	accent-color: var(--rkf-accent);
	cursor: pointer;
}

.rkf-a11y__foot {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.rkf-a11y__foot .rkf-btn {
	flex: 1 1 auto;
}

.rkf-a11y__statement {
	align-self: flex-start;
	font-size: 0.875rem;
}

/* Tablets: a box under the right end of the bar. */
@media (min-width: 40em) {
	.rkf-a11y {
		right: 16px;
		left: auto;
		width: 22rem;
		max-width: calc(100% - 32px);
		border: 1px solid var(--rkf-edge);
		border-top: 0;
	}
}

/* Desktop: under the header buttons. The header no longer sticks, so the page scrolls, not the panel. */
@media (min-width: 64em) {
	.rkf-a11y {
		top: calc(100% + 8px);
		right: 0;
		max-width: none;
		max-height: none;
		overflow: visible;
		padding: 24px;
		border-top: 1px solid var(--rkf-edge);
	}
}

/* ---------------------------------------------------------------
   Search box
---------------------------------------------------------------- */
.rkf-search {
	display: flex;
	align-items: center;
	background: var(--rkf-paper);
	border: 1px solid var(--rkf-edge);
}

.rkf-search:focus-within {
	outline: var(--rkf-focus-width) solid var(--rkf-focus);
	outline-offset: 1px;
}

.rkf-search input {
	flex: 1;
	min-width: 0;
	height: 46px;
	padding: 0 14px;
	color: var(--rkf-text);
	font-size: 1rem;
	background: transparent;
	border: 0;
	outline: 0;
}

.rkf-search input::placeholder {
	color: var(--rkf-meta);
}

.rkf-search button {
	height: 46px;
	padding: 0 14px;
	color: var(--rkf-accent);
	font-size: 0.875rem;
	font-weight: 600;
	background: none;
	border: 0;
	cursor: pointer;
}

.rkf-search button:hover {
	color: var(--rkf-accent-dark);
}

.rkf-search--header {
	display: none;
}

.rkf-search--list {
	margin: 16px 16px 0;
}

/* ---------------------------------------------------------------
   Film list
---------------------------------------------------------------- */
.rkf-list {
	max-width: var(--rkf-max);
	margin: 0 auto;
}

.rkf-cat-chips {
	display: flex;
	gap: 8px;
	padding: 12px 16px;
	overflow-x: auto;
	scrollbar-width: none;
}

.rkf-cat-chips::-webkit-scrollbar {
	display: none;
}

.rkf-cat-chip {
	display: flex;
	flex: none;
	align-items: center;
	min-height: 40px;
	padding: 0 14px;
	color: var(--rkf-text-2);
	font-size: 0.875rem;
	white-space: nowrap;
	background: var(--rkf-paper);
	border: 1px solid var(--rkf-edge);
}

.rkf-cat-chip:hover {
	color: var(--rkf-text);
	border-color: var(--rkf-text-2);
}

.rkf-cat-chip.is-on,
.rkf-cat-chip.is-on:hover {
	color: var(--rkf-on-fill);
	background: var(--rkf-text);
	border-color: var(--rkf-text);
}

.rkf-sidebar {
	display: none;
}

/* Without JavaScript the tag panel cannot open: show the sidebar above the results instead. */
.no-js .rkf-sidebar {
	display: flex;
	flex-direction: column;
	gap: 24px;
	padding: 16px;
}

.rkf-cats {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rkf-cats a {
	display: block;
	margin-left: -10px;
	padding: 6px 10px;
	color: var(--rkf-text-2);
	font-size: 0.875rem;
}

.rkf-cats a:hover {
	color: var(--rkf-text);
	background: var(--rkf-hover);
}

.rkf-cats a.is-on {
	color: var(--rkf-accent);
	font-weight: 600;
	background: var(--rkf-accent-soft);
}

.rkf-results {
	padding: 4px 16px 24px;
	scroll-margin-top: 84px; /* below the sticky header on phones */
}

/* While the next list is loading in the background. */
.rkf-results[aria-busy="true"] .rkf-grid,
.rkf-results[aria-busy="true"] .rkf-more,
.rkf-results[aria-busy="true"] .rkf-pager {
	opacity: 0.45;
	transition: opacity 0.2s;
}

.rkf-more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	margin-top: 32px;
}

.rkf-more .rkf-more__btn {
	flex: none;
	min-width: 260px;
}

.rkf-more__btn[aria-busy="true"] {
	cursor: progress;
	opacity: 0.75;
}

.rkf-more__info {
	color: var(--rkf-meta);
	font-size: 0.8125rem;
}

.rkf-results__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 12px;
}

.rkf-results__title {
	flex: 1 1 auto;
	font-size: 1.375rem;
	font-weight: 600;
	line-height: 1.2;
}

.rkf-tags-btn {
	display: flex;
	flex: none;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 14px;
	color: var(--rkf-text);
	font-size: 0.875rem;
	font-weight: 500;
	background: transparent;
	border: 1px solid var(--rkf-text);
	cursor: pointer;
}

.no-js .rkf-tags-btn {
	display: none;
}

.rkf-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.25rem;
	min-height: 1.25rem;
	padding: 0 5px;
	color: var(--rkf-on-fill);
	font-size: 0.75rem;
	background: var(--rkf-accent);
}

.rkf-clear {
	flex-basis: 100%;
	font-size: 0.875rem;
}

.rkf-empty {
	padding: 24px 0;
	color: var(--rkf-meta);
	font-size: 0.9375rem;
}

/* Film cards: a row (frame + text) on phones, a column from 640 px. */
.rkf-grid {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
}

.rkf-card {
	display: grid;
	grid-template-columns: 132px minmax(0, 1fr);
	gap: 12px;
	color: var(--rkf-text);
}

.rkf-card:hover {
	color: var(--rkf-text);
}

.rkf-card:hover .rkf-card__title {
	color: var(--rkf-accent);
}

.rkf-card__thumb {
	position: relative;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--rkf-stripes);
}

.rkf-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Darkened frame with a play mark: every card reads as a video at a glance. */
.rkf-card__thumb::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(37, 36, 31, 0.22);
	transition: background-color 0.15s;
}

.rkf-card__thumb::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 36px;
	height: 36px;
	margin: -18px 0 0 -18px;
	/* The triangle is drawn in the circle's own 52×52 box with its centroid on the centre, so it reads as centred. */
	background: var(--rkf-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 52'%3E%3Cpath d='M20.5 16.5v19L37 26z' fill='%2325241f'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
	border-radius: 50%;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
	transition: background-color 0.15s, transform 0.15s;
}

.rkf-card:hover .rkf-card__thumb::before,
.rkf-card:focus-visible .rkf-card__thumb::before {
	background-color: rgba(37, 36, 31, 0.42);
}

.rkf-card:hover .rkf-card__thumb::after,
.rkf-card:focus-visible .rkf-card__thumb::after {
	background-color: var(--rkf-accent);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 52'%3E%3Cpath d='M20.5 16.5v19L37 26z' fill='%23ffffff'/%3E%3C/svg%3E");
	transform: scale(1.08);
}

@media (min-width: 40em) {
	.rkf-card__thumb::after {
		width: 52px;
		height: 52px;
		margin: -26px 0 0 -26px;
	}
}

.rkf-card__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.rkf-card__title {
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.3;
	text-wrap: pretty;
}

.rkf-card__meta {
	color: var(--rkf-meta);
	font-size: 0.8125rem;
}

/* Pagination: previous / count / next on phones, numbered on desktop. */
.rkf-pager {
	margin-top: 24px;
}

.rkf-pager__info,
.rkf-pager__numbers {
	display: none;
}

.rkf-pager__simple {
	display: flex;
	flex-wrap: wrap; /* only in very large text */
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: 0.875rem;
}

.rkf-pager__simple a,
.rkf-pager__simple .is-disabled {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	color: var(--rkf-text);
	border: 1px solid var(--rkf-edge);
}

.rkf-pager__simple .is-disabled {
	color: var(--rkf-disabled);
	border-color: var(--rkf-line);
}

.rkf-pager__count {
	color: var(--rkf-muted);
}

/* Tag panel on phones (a <dialog> sliding up from the bottom). */
.rkf-sheet {
	width: 100%;
	max-width: 100%;
	max-height: 75vh;
	margin: auto 0 0;
	padding: 0;
	color: var(--rkf-text);
	background: var(--rkf-bg);
	border: 0;
}

.rkf-sheet::backdrop {
	background: rgba(37, 36, 31, 0.45);
}

.rkf-sheet__inner {
	display: flex;
	flex-direction: column;
	max-height: 75vh;
}

.rkf-sheet__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px;
	border-bottom: 1px solid var(--rkf-line);
}

.rkf-sheet__title {
	font-size: 1.125rem;
	font-weight: 600;
}

.rkf-sheet__close {
	width: 44px;
	height: 44px;
	margin-right: -10px;
	color: var(--rkf-text);
	font-size: 1.375rem;
	background: none;
	border: 0;
	cursor: pointer;
}

.rkf-sheet__body {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 16px;
	overflow-y: auto;
}

.rkf-sheet__foot {
	display: flex;
	gap: 8px;
	padding: 12px 16px 24px;
	border-top: 1px solid var(--rkf-line);
}

.rkf-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 12px;
	color: var(--rkf-text);
	font-size: 0.9375rem;
	background: transparent;
	border: 1px solid var(--rkf-edge);
	cursor: pointer;
}

.rkf-btn:hover {
	color: var(--rkf-text);
	border-color: var(--rkf-text-2);
}

.rkf-btn--dark {
	color: var(--rkf-on-fill);
	font-weight: 500;
	background: var(--rkf-text);
	border-color: var(--rkf-text);
}

.rkf-btn--dark:hover {
	color: var(--rkf-on-fill);
	background: var(--rkf-text-2);
	border-color: var(--rkf-text-2);
}

/* In the tag panel the two buttons share the width 1 : 2. */
.rkf-sheet__foot .rkf-btn {
	flex: 1;
}

.rkf-sheet__foot .rkf-btn--dark {
	flex: 2;
}

/* ---------------------------------------------------------------
   Film page
---------------------------------------------------------------- */
.rkf-film {
	max-width: var(--rkf-max);
	margin: 0 auto;
}

.rkf-crumbs {
	display: none;
}

.rkf-player {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #000;
}

/* Positioned absolutely, so neither the poster nor the video's own size can stretch the 16:9 box while it loads. */
.rkf-player video,
.rkf-player__missing {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.rkf-player video {
	object-fit: contain;
	background: #000;
}

.rkf-player__missing {
	display: grid;
	place-items: center;
	margin: 0;
	padding: 16px;
	color: var(--rkf-edge);
	text-align: center;
	background: #2a2924;
}

.rkf-film__intro {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 20px 16px 0;
}

.rkf-film__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	color: var(--rkf-meta);
	font-size: 0.8125rem;
}

.rkf-film__title {
	font-size: 1.625rem;
	font-weight: 600;
	line-height: 1.2;
}

.rkf-film__aside {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 16px 16px 0;
}

.rkf-facts {
	margin: 0;
}

.rkf-facts__row {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 0;
	font-size: 0.9375rem;
	border-bottom: 1px solid var(--rkf-line);
}

.rkf-facts dt {
	color: var(--rkf-meta);
}

.rkf-facts dd {
	margin: 0;
	font-weight: 500;
	text-align: right;
}

.rkf-film__tags .rkf-label {
	display: none;
}

.rkf-related {
	padding: 36px 16px 32px;
}

.rkf-related__title {
	margin-bottom: 16px;
	font-size: 1.1875rem;
	font-weight: 600;
}

.rkf-related .rkf-grid {
	margin-top: 0;
}

/* ---------------------------------------------------------------
   Pages and text
---------------------------------------------------------------- */
.rkf-page {
	display: flex;
	flex-direction: column;
	gap: 20px;
	max-width: var(--rkf-max);
	margin: 0 auto;
	padding: 24px 16px 40px;
}

.rkf-page__main {
	display: flex;
	flex-direction: column;
	gap: 20px;
	max-width: 720px;
}

.rkf-page__title {
	font-size: 1.625rem;
	font-weight: 600;
	line-height: 1.2;
}

.rkf-prose {
	color: var(--rkf-text-2);
	font-size: 0.9375rem;
	line-height: 1.6;
}

.rkf-prose > * + * {
	margin-top: 1em;
}

.rkf-prose h2,
.rkf-prose h3 {
	margin-top: 1.6em;
	color: var(--rkf-text);
	font-size: 1.1875rem;
	font-weight: 600;
	line-height: 1.3;
}

.rkf-prose a {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.rkf-prose ul,
.rkf-prose ol {
	padding-left: 1.2em;
}

.rkf-page__aside {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 20px;
	border-top: 1px solid var(--rkf-line);
}

.rkf-page__aside .rkf-label {
	margin-bottom: 0;
}

.rkf-page__org {
	font-size: 0.9375rem;
	line-height: 1.5;
}

.rkf-page__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	margin-top: 12px;
	color: var(--rkf-on-fill);
	font-size: 0.9375rem;
	font-weight: 500;
	background: var(--rkf-text);
}

.rkf-page__cta:hover {
	color: var(--rkf-on-fill);
	background: var(--rkf-text-2);
}

/* ---------------------------------------------------------------
   Footer
---------------------------------------------------------------- */
.rkf-footer {
	border-top: 1px solid var(--rkf-line);
}

.rkf-footer__inner {
	display: flex;
	flex-direction: column;
	gap: 16px;
	max-width: var(--rkf-max);
	margin: 0 auto;
	padding: 24px 16px 32px;
}

.rkf-footer__funding {
	display: flex;
	flex-direction: column;
	gap: 16px;
	order: -1;
}

.rkf-footer__logos {
	width: 100%;
	max-width: 300px;
	height: auto;
	mix-blend-mode: multiply;
}

.rkf-footer__note {
	color: var(--rkf-meta);
	font-size: 0.75rem;
	line-height: 1.45;
}

.rkf-footer__legal {
	display: flex;
	flex-direction: column-reverse;
	gap: 16px;
}

.rkf-footer__copy {
	color: var(--rkf-muted);
	font-size: 0.75rem;
}

.rkf-footer__links ul {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin: 0;
	padding: 0;
	font-size: 0.8125rem;
	list-style: none;
}

/* ---------------------------------------------------------------
   Tablet: two columns of films
---------------------------------------------------------------- */
@media (min-width: 40em) {
	.rkf-grid {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 28px 20px;
	}

	.rkf-card {
		display: flex;
		flex-direction: column;
		gap: 10px;
	}

	.rkf-card__title {
		line-height: 1.35;
	}
}

/* ---------------------------------------------------------------
   Desktop
---------------------------------------------------------------- */
@media (min-width: 64em) {
	.rkf-header {
		position: static;
	}

	.rkf-header__inner {
		flex-wrap: nowrap;
		gap: 48px;
		padding: 20px 48px;
	}

	.rkf-logo img {
		height: 76px;
	}

	.rkf-back,
	.rkf-menu-btn {
		display: none;
	}

	.rkf-nav,
	.js .rkf-nav:not(.is-open) {
		display: block;
	}

	.rkf-nav {
		flex: 0 1 auto;
		order: 0;
		margin: 0;
		border: 0;
	}

	.rkf-nav ul {
		flex-direction: row;
		gap: 32px;
	}

	.rkf-nav a {
		padding: 0 0 4px;
		font-size: 0.9375rem;
		border-bottom: 2px solid transparent;
		border-left: 0;
	}

	.rkf-nav .current-menu-item > a,
	.rkf-nav a[aria-current="page"] {
		border-bottom-color: var(--rkf-accent);
	}

	.rkf-header__tools {
		position: relative; /* the accessibility panel hangs from here */
		gap: 16px;
	}

	.rkf-search--header {
		display: flex;
		width: 19.375rem; /* 310 px: the whole "Szukaj filmu, miejscowości…" hint fits, also in larger text */
	}

	.rkf-search--header input,
	.rkf-search--header button {
		height: 42px;
	}

	.rkf-search--header input {
		font-size: 0.875rem;
	}

	.rkf-search--header button {
		font-size: 0.8125rem;
	}

	.rkf-icon-btn {
		width: 42px;
		height: 42px;
	}

	.rkf-search--list,
	.rkf-cat-chips,
	.rkf-tags-btn {
		display: none;
	}

	.rkf-list__layout {
		display: grid;
		grid-template-columns: 250px minmax(0, 1fr);
	}

	.rkf-sidebar,
	.no-js .rkf-sidebar {
		display: flex;
		flex-direction: column;
		gap: 36px;
		padding: 32px 32px 48px 48px;
		border-right: 1px solid var(--rkf-line);
	}

	.rkf-results {
		padding: 32px 48px 48px;
		scroll-margin-top: 16px;
	}

	.rkf-results__head {
		align-items: baseline;
		margin-bottom: 24px;
	}

	.rkf-results__title {
		font-size: 1.625rem;
	}

	.rkf-clear {
		flex-basis: auto;
		font-size: 0.8125rem;
	}

	/* Three columns; two when larger text would make them narrower than 12rem. */
	.rkf-grid {
		grid-template-columns: repeat(auto-fill, minmax(max(12rem, 30%), 1fr));
		margin-top: 0;
	}

	.rkf-pager {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		padding-top: 20px;
		border-top: 1px solid var(--rkf-line);
	}

	.rkf-pager__simple {
		display: none;
	}

	.rkf-pager__info {
		display: block;
		color: var(--rkf-muted);
		font-size: 0.875rem;
	}

	.rkf-pager__numbers {
		display: flex;
		flex-wrap: wrap;
		gap: 4px;
		font-size: 0.875rem;
	}

	.rkf-pager__numbers .page-numbers {
		padding: 8px 13px;
		color: var(--rkf-text);
		border: 1px solid var(--rkf-edge);
	}

	.rkf-pager__numbers a.page-numbers:hover {
		border-color: var(--rkf-text);
	}

	.rkf-pager__numbers .current {
		color: var(--rkf-on-fill);
		background: var(--rkf-text);
		border-color: var(--rkf-text);
	}

	.rkf-pager__numbers .dots {
		color: var(--rkf-meta);
		border-color: transparent;
	}

	.rkf-pager__numbers .prev,
	.rkf-pager__numbers .next {
		padding: 8px 16px;
	}

	.rkf-crumbs {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		padding: 20px 48px 0;
		color: var(--rkf-meta);
		font-size: 0.8125rem;
	}

	.rkf-crumbs [aria-current] {
		color: var(--rkf-text);
	}

	.rkf-film__layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 300px;
		gap: 40px;
		padding: 20px 48px 0;
	}

	.rkf-film__main {
		display: flex;
		flex-direction: column;
		gap: 24px;
	}

	.rkf-film__intro {
		gap: 24px;
		padding: 0;
	}

	.rkf-film__meta {
		display: none;
	}

	.rkf-film__title {
		font-size: 2.125rem;
		line-height: 1.15;
	}

	.rkf-film__aside {
		gap: 28px;
		padding: 0;
	}

	.rkf-facts__row {
		font-size: 0.875rem;
	}

	.rkf-film__tags .rkf-label {
		display: block;
	}

	.rkf-chips--film {
		gap: 6px;
	}

	.rkf-chips--film .rkf-chip {
		min-height: 0;
		padding: 4px 9px;
		font-size: 0.8125rem;
	}

	.rkf-related {
		padding: 56px 48px 48px;
	}

	.rkf-related__title {
		margin-bottom: 24px;
		font-size: 1.375rem;
	}

	/* Four columns, fewer in larger text (as in the list above). */
	.rkf-related .rkf-grid {
		grid-template-columns: repeat(auto-fill, minmax(max(12rem, 22%), 1fr));
		gap: 20px;
	}

	.rkf-page {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 300px;
		gap: 56px;
		padding: 56px 48px 72px;
	}

	.rkf-page__main {
		gap: 24px;
	}

	.rkf-page__title {
		font-size: 2.125rem;
		line-height: 1.15;
	}

	.rkf-page__aside {
		gap: 12px;
		padding-top: 0;
		border-top: 0;
	}

	.rkf-page__cta,
	.rkf-page__cta:hover {
		display: inline;
		min-height: 0;
		color: var(--rkf-accent);
		font-size: 0.875rem;
		background: none;
	}

	.rkf-page__cta:hover {
		color: var(--rkf-accent-dark);
	}

	.rkf-page__cta::after {
		content: " →";
	}

	.rkf-footer__inner {
		flex-direction: row;
		align-items: center;
		gap: 40px;
		padding: 32px 48px;
	}

	.rkf-footer__legal {
		flex-direction: column;
		gap: 6px;
	}

	.rkf-footer__links ul {
		gap: 16px;
		font-size: 0.75rem;
	}

	.rkf-footer__funding {
		align-items: flex-end;
		gap: 8px;
		order: 0;
		margin-left: auto;
	}

	.rkf-footer__logos {
		width: auto;
		max-width: none;
		height: 44px;
	}

	.rkf-footer__note {
		max-width: 420px;
		font-size: 0.6875rem;
		line-height: 1.4;
		text-align: right;
	}
}

/* ---------------------------------------------------------------
   Ułatwienia dostępu → Rozmiar tekstu and Większe odstępy: layout
---------------------------------------------------------------- */
@media (min-width: 64em) {
	/* The menu moves to its own row under the logo: the header (at most 1280 px wide) cannot fit it next to the buttons. */
	html[data-rkf-text] .rkf-header__inner,
	html[data-rkf-spacing] .rkf-header__inner {
		flex-wrap: wrap;
		row-gap: 12px;
	}

	html[data-rkf-text] .rkf-nav,
	html[data-rkf-spacing] .rkf-nav {
		flex-basis: 100%;
		order: 10;
	}

	/* Wider letter spacing: the search hint still fits whole. */
	html[data-rkf-spacing] .rkf-search--header {
		width: 24rem;
	}
}

@media (max-width: 39.99em) {
	/* Phones in the largest text: the frame goes above the title, which gets the full width. */
	html[data-rkf-text="150"] .rkf-card {
		grid-template-columns: minmax(0, 1fr);
	}

	html[data-rkf-text="150"] .rkf-card__thumb::after {
		width: 52px;
		height: 52px;
		margin: -26px 0 0 -26px;
	}

	/* Pager: the page count gets its own row; "Poprzednia" and "Następna" share a row or each fill one. */
	html[data-rkf-text] .rkf-pager__count,
	html[data-rkf-spacing] .rkf-pager__count {
		flex-basis: 100%;
		order: 1;
		text-align: center;
	}

	html[data-rkf-text] .rkf-pager__simple :is(a, .is-disabled),
	html[data-rkf-spacing] .rkf-pager__simple :is(a, .is-disabled) {
		flex: 1 1 auto;
		justify-content: center;
	}
}

/* ---------------------------------------------------------------
   Ułatwienia dostępu → Większe odstępy w tekście: the spacing from WCAG 2.1 criterion 1.4.12
   (lines at least 1.5, paragraphs 2em apart, letters 0.12em, words 0.16em).
---------------------------------------------------------------- */
html[data-rkf-spacing] :is(body, button, input) {
	letter-spacing: 0.12em;
	word-spacing: 0.16em;
}

html[data-rkf-spacing] body * {
	line-height: 1.6;
}

html[data-rkf-spacing] .rkf-prose,
html[data-rkf-spacing] .rkf-prose * {
	line-height: 1.8;
}

html[data-rkf-spacing] .rkf-prose > * + * {
	margin-top: 2em;
}

/* ---------------------------------------------------------------
   Ułatwienia dostępu → Podkreślone linki
---------------------------------------------------------------- */
html[data-rkf-links] a:not(.rkf-logo, .rkf-back, .rkf-icon-btn, .rkf-card),
html[data-rkf-links] .rkf-card__title {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* ---------------------------------------------------------------
   Ułatwienia dostępu → Kontrast: Wysoki. Yellow on black (19.6:1, WCAG AAA). Links in text are underlined,
   filled buttons and chips turn black on yellow, the focus outline is thick and white.
---------------------------------------------------------------- */
html[data-rkf-contrast="high"] {
	--rkf-bg: #000;
	--rkf-paper: #000;
	--rkf-text: #ff0;
	--rkf-text-2: #ff0;
	--rkf-muted: #ff0;
	--rkf-meta: #ff0;
	--rkf-disabled: #a3a3a3;
	--rkf-line: #ff0;
	--rkf-edge: #ff0;
	--rkf-accent: #ff0;
	--rkf-accent-dark: #fff;
	--rkf-accent-soft: #000;
	--rkf-hover: #000;
	--rkf-on-fill: #000;
	--rkf-focus: #fff;
	--rkf-focus-width: 3px;
	--rkf-stripes: repeating-linear-gradient(135deg, #1c1c1c 0 8px, #111 8px 16px);
	color-scheme: dark;
}

html[data-rkf-contrast="high"] ::selection {
	color: #000;
	background: #fff;
}

html[data-rkf-contrast="high"] :focus-visible {
	outline-offset: 3px;
}

/* Colour alone no longer tells links apart from text. */
html[data-rkf-contrast="high"] :is(.rkf-prose, .rkf-facts, .rkf-film__meta, .rkf-crumbs, .rkf-empty, .rkf-footer) a,
html[data-rkf-contrast="high"] :is(.rkf-clear, .rkf-page__cta, .rkf-a11y__statement) {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* Hover changes colour no more: links and buttons underline, filled buttons turn white. */
html[data-rkf-contrast="high"] :is(a, button):hover {
	text-decoration: underline;
}

html[data-rkf-contrast="high"] .rkf-btn--dark:hover {
	background: #fff;
	border-color: #fff;
}

html[data-rkf-contrast="high"] .rkf-cats a.is-on {
	color: var(--rkf-on-fill);
	background: var(--rkf-text);
}

html[data-rkf-contrast="high"] :is(.rkf-chip.is-disabled, .rkf-pager__simple .is-disabled) {
	border-style: dashed;
	border-color: var(--rkf-disabled);
}

/* The play mark: a yellow triangle in a black circle; inverted on hover and focus. */
html[data-rkf-contrast="high"] .rkf-card__thumb::after {
	background-color: #000;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 52'%3E%3Cpath d='M20.5 16.5v19L37 26z' fill='%23ffff00'/%3E%3C/svg%3E");
	box-shadow: 0 0 0 2px #ff0;
}

html[data-rkf-contrast="high"] .rkf-card:hover .rkf-card__thumb::after,
html[data-rkf-contrast="high"] .rkf-card:focus-visible .rkf-card__thumb::after {
	background-color: #ff0;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 52'%3E%3Cpath d='M20.5 16.5v19L37 26z' fill='%23000000'/%3E%3C/svg%3E");
}

html[data-rkf-contrast="high"] .rkf-card:is(:hover, :focus-visible) .rkf-card__title {
	text-decoration: underline;
}

/* The RKF logo and the funding logos are drawn for a light background: they keep a white one. */
html[data-rkf-contrast="high"] .rkf-logo img {
	background: #fff;
	box-shadow: 0 0 0 4px #fff;
}

html[data-rkf-contrast="high"] .rkf-logo:focus-visible {
	outline-offset: 8px;
}

html[data-rkf-contrast="high"] .rkf-footer__logos {
	mix-blend-mode: normal;
}

html[data-rkf-contrast="high"] .rkf-sheet {
	border-top: 2px solid var(--rkf-line);
}

html[data-rkf-contrast="high"] .rkf-a11y {
	box-shadow: none;
}

/* ---------------------------------------------------------------
   Windows high contrast (forced colours): selected chips, pages and options keep a visible fill;
   the logos and the play mark keep their own colours instead of vanishing on the system background.
---------------------------------------------------------------- */
@media (forced-colors: active) {
	.rkf-chip.is-on,
	.rkf-cat-chip.is-on,
	.rkf-cats a.is-on,
	.rkf-pager__numbers .current,
	.rkf-a11y__option input:checked + .rkf-a11y__face {
		forced-color-adjust: none;
		color: HighlightText;
		background: Highlight;
		border-color: Highlight;
	}

	.rkf-logo img {
		forced-color-adjust: none;
		background: #fff;
		box-shadow: 0 0 0 4px #fff;
	}

	.rkf-footer__logos {
		mix-blend-mode: normal;
	}

	.rkf-card__thumb::after {
		forced-color-adjust: none;
	}
}

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