/*
Theme Name: Narwik
Description: Motyw strony Zespołu Szkół im. Bohaterów Narwiku. Sześć wyglądów strony głównej do wyboru jednym przyciskiem.
Version: 0.5.1
Requires at least: 6.6
Requires PHP: 8.1
Text Domain: narwik
License: GPL-2.0-or-later
*/

:root {
	--gutter: clamp(16px, 4vw, 40px);
	--section: clamp(48px, 5vw, 72px);
	--tap: 48px;
	--radius-sm: 4px;
	--radius-md: 8px;
	--shadow-card: 0 1px 2px rgb(23 32 54 / 0.08), 0 4px 16px rgb(23 32 54 / 0.06);
	--shadow-raised: 0 2px 4px rgb(23 32 54 / 0.1), 0 12px 32px rgb(23 32 54 / 0.1);
	--ease: cubic-bezier(0.2, 0.6, 0.2, 1);
	--navy: var(--wp--preset--color--navy);
	--navy-dark: var(--wp--preset--color--navy-dark);
	--navy-light: var(--wp--preset--color--navy-light);
	--line: var(--wp--preset--color--line);
	--red: var(--wp--preset--color--red);
	--red-dark: var(--wp--preset--color--red-dark);
	--gold: var(--wp--preset--color--gold);
	--ink: var(--wp--preset--color--ink);
	--muted: var(--wp--preset--color--ink-muted);
	--white: var(--wp--preset--color--white);
	--font-display: var(--wp--preset--font-family--display);
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-padding-bottom: 80px;
}

/* Header, page and footer follow each other with no white strip between them. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* Also images placed inside a paragraph or a link. */
img {
	max-width: 100%;
	height: auto;
}

h1,
h2,
h3 {
	text-wrap: balance;
}

a {
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

a:hover {
	text-decoration-thickness: 2px;
}

/* Two-tone ring: visible on white, navy and photos alike. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--navy-dark);
	outline-offset: 2px;
	box-shadow: 0 0 0 5px var(--white);
}

.skip-link.screen-reader-text:focus {
	background: var(--navy-dark);
	color: var(--gold);
	font-family: var(--font-display);
	font-size: 18px;
	padding: 12px 20px;
}

.wp-element-button,
.wp-block-button__link {
	min-height: var(--tap);
	display: inline-flex;
	align-items: center;
	transition: background-color 150ms var(--ease);
}

/* Header */

/* The header's menus open over the page title and the photo below it. */
.site-header {
	position: relative;
	z-index: 10;
}

.site-header__actions {
	gap: 8px;
}

/* GTranslate's floating button; the language list in the header drives the same translation. */
.gtranslate_wrapper {
	display: none;
}

.language-switcher {
	position: relative;
}

.language-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: var(--tap);
	padding: 0 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--white);
	color: var(--navy-dark);
	font-family: var(--font-display);
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0.04em;
	cursor: pointer;
	transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}

.language-switcher__toggle:hover {
	border-color: var(--navy);
	background: var(--navy-light);
}

.language-switcher__toggle::after {
	content: "";
	width: 7px;
	height: 7px;
	margin: 0 2px 4px 2px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
}

.language-switcher__toggle[aria-expanded="true"]::after {
	margin-bottom: 0;
	transform: rotate(-135deg);
}

.language-switcher__list {
	position: absolute;
	z-index: 3;
	top: calc(100% + 8px);
	left: 0;
	min-width: 200px;
	margin: 0;
	padding: 8px 0;
	list-style: none;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-raised);
}

.language-switcher__list button {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	width: 100%;
	min-height: 44px;
	padding: 0 16px;
	border: 0;
	background: none;
	color: var(--ink);
	font: inherit;
	font-size: 17px;
	text-align: left;
	cursor: pointer;
}

.language-switcher__list button:hover {
	background: var(--navy-light);
}

.language-switcher__list button[aria-current="true"] {
	color: var(--navy-dark);
	font-weight: 700;
}

.language-switcher__list button[aria-current="true"]::after {
	content: "✓";
}

.site-utility {
	font-size: var(--wp--preset--font-size--meta);
}

.site-utility a {
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	min-height: 40px;
}

.site-utility a:hover {
	text-decoration: underline;
}

.site-header__main {
	border-bottom: 1px solid var(--line);
}

.site-brand {
	text-decoration: none;
	display: flex;
	align-items: center;
	gap: 12px;
	color: var(--navy-dark);
}

.site-brand img {
	width: 48px;
	height: 48px;
}

.site-brand__name {
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 17px;
	line-height: 1.15;
}

.site-brand__name span {
	display: block;
	font-weight: 500;
}

.site-header .wp-block-navigation {
	font-size: 18px;
}

.site-header .wp-block-navigation-item__content {
	min-height: var(--tap);
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.site-header .wp-block-navigation .wp-block-navigation__submenu-container {
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-raised);
	padding: 8px 0;
	min-width: 260px;
	font-size: 17px;
}

/* The three right-most menus open their second level to the left, so it stays on screen from 960 px up. */
.site-header .wp-block-navigation__container > .wp-block-navigation-item:nth-last-child(-n + 3) .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container {
	left: auto;
	right: 100%;
}

/* The two right-most menus open their list from their right edge, so it stays on screen on tablets. */
.site-header .wp-block-navigation__container > .wp-block-navigation-item:nth-last-child(-n + 2) > .wp-block-navigation__submenu-container {
	left: auto;
	right: 0;
}

.site-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 10px 16px;
	min-height: 44px;
}

.site-header .wp-block-navigation__responsive-container-open,
.site-header .wp-block-navigation__responsive-container-close {
	min-width: var(--tap);
	min-height: var(--tap);
	justify-content: center;
	align-items: center;
}

@media (min-width: 960px) {
	.site-brand img {
		width: 64px;
		height: 64px;
	}
}

@media (max-width: 599px) {
	.site-brand__name {
		font-size: 14px;
	}

	.site-header__actions {
		gap: 4px;
	}

	.language-switcher__toggle {
		justify-content: center;
		min-width: 44px;
		padding: 0;
		border-color: transparent;
	}

	.language-switcher__code,
	.language-switcher__toggle::after {
		display: none;
	}

	.site-header__cta .wp-block-button__link {
		padding: 10px 14px;
		font-size: 16px;
		min-height: 44px;
	}
}

/* Hidden from sight only on the narrowest phones (the students look keeps it on the photo): screen readers still read the school's name in the home link. */
@media (max-width: 379px) {
	:root:not([data-look="students"]) .site-brand__name {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

/* Cards and news */

.news-card {
	position: relative;
	background: var(--white);
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-card);
	overflow: hidden;
	transition: box-shadow 200ms var(--ease);
	height: 100%;
}

.news-card:hover {
	box-shadow: var(--shadow-raised);
}

.news-card .wp-block-post-featured-image {
	margin: 0;
}

.news-card .wp-block-post-title a {
	text-decoration: none;
	color: var(--navy-dark);
}

.news-card .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.news-card:hover .wp-block-post-title a {
	text-decoration: underline;
}

.news-card:focus-within {
	outline: 3px solid var(--navy-dark);
	outline-offset: 2px;
}

.news-card .wp-block-post-title a:focus-visible {
	outline: none;
	box-shadow: none;
}

.news-card .wp-block-post-excerpt__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.news-card .wp-block-post-excerpt__more-text {
	display: none;
}

.wp-block-post-featured-image img {
	object-fit: cover;
}

.more-link a {
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 18px;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	min-height: var(--tap);
	gap: 8px;
}

.more-link a::after {
	content: "→";
	transition: transform 150ms var(--ease);
}

.more-link a:hover::after {
	transform: translateX(3px);
}

/* Home sections */

.label {
	font-family: var(--font-display);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--label);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.notice-strip p {
	margin: 0;
}

.ranking {
	display: grid;
	grid-template-columns: minmax(0, 200px) 1fr;
	gap: 32px;
	align-items: center;
}

.ranking__badges {
	display: flex;
	gap: 12px;
	align-items: center;
}

.ranking__badges img {
	display: block;
	height: auto;
	border-radius: var(--radius-sm);
}

.ranking__list {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.ranking__list li {
	padding: 8px 24px;
	border-left: 1px solid rgb(255 255 255 / 0.25);
	font-size: 20px;
	line-height: 1.3;
}

.ranking__list strong {
	display: block;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: clamp(40px, 4vw, 56px);
	line-height: 1;
	color: var(--gold);
}

@media (max-width: 959px) {
	.ranking {
		grid-template-columns: 1fr;
	}

	.ranking__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		row-gap: 16px;
	}
}

.poster-card {
	display: grid;
	grid-template-columns: 160px minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

.poster-card img {
	width: 160px;
	height: auto;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
}

.poster-card details {
	margin-top: 12px;
}

.poster-card summary {
	cursor: pointer;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 18px;
	color: var(--navy);
	min-height: var(--tap);
	display: flex;
	align-items: center;
}

.poster-card:not(:has(> img)) {
	grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 639px) {
	.poster-card {
		grid-template-columns: 1fr;
	}

	.poster-card img {
		width: 100%;
		max-width: 320px;
	}
}

.student-links ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.student-links li + li {
	border-top: 1px solid var(--line);
}

.student-links a {
	display: flex;
	justify-content: space-between;
	align-items: center;
	min-height: 52px;
	font-weight: 600;
	text-decoration: none;
	color: var(--navy-dark);
}

.student-links a::after {
	content: "→";
	color: var(--navy);
}

.student-links a:hover {
	text-decoration: underline;
}

.open-day-photos {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

.open-day-photos img {
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	border-radius: var(--radius-md);
	display: block;
}

/* Pages and posts */

.wp-block-post-content :where(h2, h3, h4, h5, h6):not(.wp-block-post-title) {
	margin-block-start: 1.6em;
}

.wp-block-post-content > :where(h2, h3, h4, h5, h6):first-child {
	margin-block-start: 0;
}

/* A long address written out as the link text breaks onto the next line instead of widening the page. */
.wp-block-post-content a {
	overflow-wrap: anywhere;
}

.wp-block-table table {
	border-collapse: collapse;
	font-size: 16px;
	font-variant-numeric: tabular-nums;
}

.wp-block-table :where(th, td) {
	border: 1px solid var(--line);
	padding: 10px 14px;
	text-align: left;
	vertical-align: top;
}

.wp-block-table th {
	background: var(--navy-light);
	color: var(--navy-dark);
	font-family: var(--font-display);
	font-weight: 600;
}

.wp-block-table thead {
	border-bottom: 2px solid var(--navy);
}

.wp-block-table tbody tr:has(td):nth-child(even) {
	background: rgb(232 236 246 / 0.4);
}

.wp-block-details {
	border-top: 1px solid var(--line);
}

.wp-block-details + .wp-block-details {
	margin-block-start: 0;
}

.wp-block-details:not(:has(+ .wp-block-details)) {
	border-bottom: 1px solid var(--line);
}

.wp-block-details > summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	min-height: 60px;
	padding-block: 12px;
	list-style: none;
	color: var(--navy-dark);
	font-family: var(--font-display);
	font-size: 20px;
	font-weight: 600;
	cursor: pointer;
}

.wp-block-details > summary::-webkit-details-marker {
	display: none;
}

.wp-block-details > summary::after {
	content: "";
	flex: none;
	width: 9px;
	height: 9px;
	margin: 0 6px 6px 0;
	border-right: 2px solid var(--navy);
	border-bottom: 2px solid var(--navy);
	transform: rotate(45deg);
	transition: transform 150ms var(--ease);
}

.wp-block-details[open] > summary::after {
	margin-bottom: 0;
	transform: rotate(-135deg);
}

.wp-block-details > summary:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.wp-block-details[open] {
	padding-bottom: 24px;
}

.wp-block-gallery img,
.wp-block-media-text__media img {
	border-radius: var(--radius-sm);
}

.wp-block-query-pagination {
	gap: 8px;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 18px;
}

.wp-block-query-pagination-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.wp-block-query-pagination :where(.page-numbers, .wp-block-query-pagination-previous, .wp-block-query-pagination-next) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: var(--tap);
	min-height: var(--tap);
	padding: 0 12px;
	border-radius: var(--radius-sm);
	text-decoration: none;
}

.wp-block-query-pagination :where(a.page-numbers, .wp-block-query-pagination-previous, .wp-block-query-pagination-next):hover {
	background: var(--navy-light);
}

.wp-block-query-pagination .page-numbers.current {
	background: var(--navy);
	color: var(--white);
}

/* Footer */

.site-footer a {
	text-decoration: none;
}

.site-footer a:hover {
	text-decoration: underline;
}

.site-footer :where(a, button):focus-visible {
	outline-color: var(--gold);
	box-shadow: none;
}

.site-footer ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.site-footer li a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}

.site-footer .wp-block-column {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.site-footer .wp-block-column > * {
	margin: 0;
}

.site-footer .label {
	margin-bottom: 8px;
}

.footer-schools {
	display: grid;
	gap: 16px;
}

.footer-school {
	margin: 0;
}

.footer-school {
	display: flex;
	gap: 12px;
	align-items: center;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 16px;
	line-height: 1.2;
}

.footer-school img {
	width: 56px;
	height: 56px;
	padding: 6px;
	background: var(--white);
	border-radius: 50%;
	object-fit: contain;
	flex: none;
}

body {
	padding-bottom: 72px;
}

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

@media print {
	.look-switcher {
		display: none;
	}
}
