/*
Theme Name:        Object Lessons
Description:       Block theme for objectlessons.org, the Islington Education Library Service online museum. Works with the iels-artefacts plugin.
Version:           0.2.0
Requires at least: 6.6
Requires PHP:      8.3
Author:            IELS
License:           GPL-2.0-or-later
Text Domain:       objectlessons
*/

/*
 * Most styling is in theme.json. This file holds what theme.json can't
 * express: the page "sheet", header/footer chrome, focus styles and
 * reduced-motion handling. Colours come from the theme.json palette.
 */

/* ---------- Page sheet: white page on grey, as on the 2011 site ---------- */

/* The original page was 934px of white on a shadowed grey strip (bkg.png). */
html body {
	background: #f0f0f0 url("assets/img/bkg.png") repeat-y top center;
}

.wp-site-blocks {
	max-width: 934px;
	margin-inline: auto;
	background: var(--wp--preset--color--surface);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.wp-site-blocks > main {
	flex: 1 0 auto;
}

@media (min-width: 960px) {
	/* The header image supplies the 10px of grey above the sheet. */
	.wp-site-blocks {
		margin-bottom: 10px;
		min-height: calc(100vh - 10px);
	}
}

/* ---------- Header ---------- */

/*
 * Original geometry: bkg-hd.png (950x230, centred, so 8px of its edge shadow is
 * cropped by the 934px sheet) holds the blue-to-white fade AND the key logo.
 * The logo file is an exact 249x84 crop of it at (14,14), so on wide screens it
 * is laid over the baked-in key at (6,14) and the two line up pixel for pixel.
 * Below 960px the image is dropped for a plain CSS fade and the logo flows.
 */
.ol-masthead {
	background: linear-gradient(180deg, #3399cc 0, #3399cc 215px, #fff 245px);
	color: #fff;
}

.ol-header {
	position: relative;
	padding: 15px 20px 0;
}

/*
 * Header text is white as on the original (#39c gives only about 3:1, a
 * deliberate fidelity-over-WCAG-AA choice). A subtle dark shadow helps legibility.
 * Current page and hover use the original's yellows (#dbdb00 / #cc0).
 */
.ol-header,
.ol-header a {
	color: #fff;
	text-decoration: none;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.ol-header a:hover,
.ol-header a:focus-visible {
	color: #cc0;
	text-decoration: underline;
}

.ol-header a[aria-current] {
	color: #dbdb00;
}

.ol-header .wp-block-site-logo {
	margin: 0 0 10px;
}

.ol-header .wp-block-site-logo img {
	display: block;
	max-width: 100%;
	height: auto;
}

.ol-header .wp-block-site-title {
	margin: 0;
}

.ol-header .wp-block-site-title a {
	font-size: var(--wp--preset--font-size--x-large);
	font-family: var(--wp--preset--font-family--serif);
}

.ol-header__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem 1rem;
	font-size: 0.8125rem;
}

.ol-header .wp-block-site-tagline {
	margin: 0.75rem 0;
	font-family: var(--wp--preset--font-family--serif);
	font-style: italic;
	font-size: 0.9rem;
}

.ol-header .wp-block-search {
	display: flex;
	align-items: center;
	gap: 0.3rem;
	margin: 0;
	white-space: nowrap;
}

.ol-header .wp-block-search__label {
	margin: 0;
}

.ol-header .wp-block-search__label {
	font-size: 0.8125rem;
	color: #fff;
}

.ol-header .wp-block-search__inside-wrapper {
	align-items: center;
}

.ol-header .wp-block-search__input {
	min-width: 0;
	width: 110px;
	border: 1px solid #666;
	border-radius: 0;
	padding: 1px 3px;
	height: 18px;
	box-sizing: border-box;
	font-size: 0.8125rem;
	color: #666;
	text-shadow: none;
}

.ol-header .wp-block-search .wp-block-search__button {
	display: inline-flex;
	align-items: center;
	background: transparent !important;
	color: #fff;
	border: 0;
	border-radius: 2px;
	margin-left: 0.25rem;
	padding: 1px 2px;
	min-width: 0;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.ol-header .wp-block-search__button svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.ol-header .wp-block-search__button:hover,
.ol-header .wp-block-search__button:focus-visible {
	color: #cc0;
	text-decoration: none;
	background: transparent;
}

@media (min-width: 960px) {
	.ol-masthead {
		background: url("assets/img/bkg-hd.png") no-repeat center top;
		min-height: 220px;
	}

	.ol-header {
		height: 108px;
		padding: 0;
	}

	.ol-header .wp-block-site-logo {
		position: absolute;
		top: 14px;
		left: 6px;
		width: 249px;
		margin: 0;
	}

	.ol-header .wp-block-site-title {
		position: absolute;
		top: 20px;
		left: 20px;
	}

	/* Links and search: the 650px column to the right of the logo. */
	.ol-header__tools {
		position: absolute;
		top: 1px;
		left: 267px;
		right: 20px;
	}

	.ol-header__row {
		flex-wrap: nowrap;
	}

	.ol-header .wp-block-site-tagline {
		margin: 26px 0 0;
		text-align: center;
	}
}

/* ---------- Navigation (iels/ol-nav) ---------- */

.ol-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
}

.ol-nav__link {
	text-decoration: none;
}

/* Pages: a row of links in the blue header. */
.ol-nav--pages .ol-nav__list {
	gap: 0.25rem 0.75rem;
	align-items: center;
}

.ol-nav--pages .ol-nav__link[aria-current] {
	text-decoration: underline;
}

.ol-nav--pages .ol-nav__item--social .ol-nav__link {
	display: block;
	line-height: 0;
}

/*
 * Themes: the icon bar. NAV-Na.png (about 30x50) has the header fade baked in
 * behind it, so the row starts where the original's did (y=98) and overlaps the
 * fade. Wide screens use 9 fixed columns on the original's centres.
 */
.ol-themebar {
	padding: 0 20px 5px;
}

.ol-nav--themes .ol-nav__list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
	gap: 0.25rem;
}

@media (min-width: 960px) {
	.ol-themebar {
		padding: 0;
	}

	.ol-nav--themes .ol-nav__list {
		grid-template-columns: repeat(9, 106.6px);
		gap: 0;
		width: 960px;
		margin-left: -13px;
		overflow: hidden;
	}
}

.ol-nav--themes .ol-nav__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.2rem;
	padding: 0 10px;
	color: #666;
	font-size: 0.6875rem;
	letter-spacing: 0.03em;
	line-height: 1.0;
	text-align: center;
	text-transform: uppercase;
}

.ol-nav--themes .ol-nav__icon {
	width: auto;
	height: 50px;
	max-width: 100%;
}

/* Rollover: the "b" icon replaces the "a" icon on hover and keyboard focus. */
.ol-nav--themes .ol-nav__link {
	position: relative;
}

.ol-nav--themes .ol-nav__icon--hover {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	opacity: 0;
}

.ol-nav--themes .ol-nav__link:hover .ol-nav__icon--hover,
.ol-nav--themes .ol-nav__link:focus-visible .ol-nav__icon--hover,
.ol-nav--themes .ol-nav__link[aria-current] .ol-nav__icon--hover {
	opacity: 1;
}

.ol-nav--themes .ol-nav__link:hover,
.ol-nav--themes .ol-nav__link[aria-current] {
	color: var(--wp--preset--color--link);
}

.ol-nav--themes .ol-nav__label {
	text-wrap: balance;
}

.ol-nav--themes .ol-nav__link[aria-current] .ol-nav__label {
	border-bottom: 2px solid currentColor;
}

/* Subsections of the current theme: a centred row of links. */
.ol-nav--subsections {
	margin-top: var(--wp--preset--spacing--10);
	padding-top: var(--wp--preset--spacing--10);
	border-top: 1px dotted var(--wp--preset--color--heading);
}

.ol-nav--subsections .ol-nav__list {
	justify-content: center;
	gap: 0.25rem 1.25rem;
}

.ol-nav--subsections .ol-nav__link {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.03em;
}

.ol-nav--subsections .ol-nav__link:hover {
	text-decoration: underline;
}

.ol-nav--subsections .ol-nav__link[aria-current] {
	color: var(--wp--preset--color--text);
	font-weight: 700;
}

/* ---------- Tile grids (iels/ol-section-view) ---------- */

.ol-tiles {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(10rem, 42vw), 1fr));
	gap: var(--wp--preset--spacing--30);
}

.ol-tiles--themes {
	grid-template-columns: repeat(auto-fit, minmax(0, min(13rem, calc(50% - 0.625rem))));
	justify-content: center;
}

.ol-tile__link {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	height: 100%;
	color: var(--wp--preset--color--heading);
	text-decoration: none;
	font-family: var(--wp--preset--font-family--serif);
	font-style: italic;
	line-height: 1.25;
}

.ol-tile__image {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	border: 1px solid var(--wp--preset--color--tint);
	background: var(--wp--preset--color--page);
}

.ol-tile__label {
	font-size: var(--wp--preset--font-size--large);
}

.ol-tiles--themes .ol-tile__label {
	text-align: center;
}

.ol-tile__meta {
	font-family: var(--wp--preset--font-family--sans);
	font-style: normal;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--heading);
}

.ol-tile__link:hover .ol-tile__label,
.ol-tile__link:focus-visible .ol-tile__label {
	color: var(--wp--preset--color--link);
	text-decoration: underline;
}

.ol-tile__link:hover .ol-tile__image {
	border-color: var(--wp--preset--color--brand);
}

/* Section pages: breadcrumb, title, pagination. */
.ol-breadcrumb ol {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.5rem;
	margin: 0 0 var(--wp--preset--spacing--20);
	padding: 0;
	font-size: var(--wp--preset--font-size--small);
}

.ol-breadcrumb li + li::before {
	content: "\203A";
	margin-right: 0.5rem;
}

.ol-artefact-title,
.ol-section__title {
	text-align: center;
	margin-bottom: var(--wp--preset--spacing--20);
}

.ol-section__description {
	max-width: 40rem;
	margin: 0 auto var(--wp--preset--spacing--40);
	text-align: center;
}

.ol-section__empty {
	text-align: center;
}

.ol-pagination {
	margin-top: var(--wp--preset--spacing--40);
}

.ol-pagination ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
}

.ol-pagination .page-numbers {
	display: inline-block;
	min-width: 2.75rem;
	padding: 0.5rem 0.75rem;
	text-align: center;
	border: 1px solid var(--wp--preset--color--tint);
	text-decoration: none;
}

.ol-pagination a.page-numbers:hover {
	border-color: var(--wp--preset--color--brand);
	text-decoration: underline;
}

.ol-pagination .page-numbers.current {
	background: var(--wp--preset--color--link);
	border-color: var(--wp--preset--color--link);
	color: #fff;
}

/* ---------- Home page ---------- */

.ol-splash .iels-ol-swf {
	margin-inline: auto;
}

/* ---------- Search results ---------- */

.ol-results__list {
	list-style: none;
	padding: 0;
}

.ol-result {
	gap: var(--wp--preset--spacing--30);
	padding-block: var(--wp--preset--spacing--20);
	border-bottom: 1px dotted var(--wp--preset--color--tint);
}

.ol-result .wp-block-post-featured-image {
	flex: 0 0 96px;
	margin: 0;
}

.ol-result .wp-block-post-title {
	margin: 0;
}

@media (max-width: 600px) {
	.ol-header__tools.ol-header__tools {
		align-items: flex-start;
	}
	.ol-nav--pages .ol-nav__list {
		justify-content: flex-start;
	}
}

/* ---------- Footer ---------- */

.ol-footer {
	position: relative;
	box-sizing: border-box;
	min-height: 120px;
	padding: 70px 20px 0 !important;
	background: #3399cc url("assets/img/bkg-ft.png") no-repeat center bottom !important;
}

.ol-footer__logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	padding-bottom: 8px;
}

.ol-footer__partners {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ol-footer__logos img {
	display: block;
	max-width: 100%;
	height: auto;
}

.ol-footer a:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-light);
	outline-offset: 2px;
}

@media (max-width: 600px) {
	.ol-footer__logos {
		flex-direction: column;
		align-items: center;
	}
}

/* ---------- Content ---------- */

/* "Boxed text" group style (the old div.boxedtxt), used for the home welcome. */
.wp-block-group.is-style-ol-boxed {
	max-width: 550px;
	margin-inline: auto;
	padding: 6px 8px;
	background: linear-gradient(0deg, rgb(223, 239, 247) 10%, rgb(255, 255, 255) 90%);
	border: 1px solid #dfeff7;
	font-family: Georgia, "Times New Roman", serif;
	font-style: italic;
	text-align: justify;
}

dfn {
	color: var(--wp--preset--color--link);
	border-bottom: 1px dotted currentColor;
	font-style: normal;
}

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

/* ---------- Accessibility ---------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--wp--preset--color--link-hover);
	outline-offset: 2px;
	border-radius: 2px;
}

/* On the blue chrome, the dark outline would vanish: use yellow instead. */
:where(.ol-header, .ol-footer) :where(a, button, input, [tabindex]):focus-visible {
	outline-color: var(--wp--preset--color--accent-light);
}

/* Core prints the skip link; make sure it's prominent when focused. */
.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--link-hover);
	outline: 3px solid var(--wp--preset--color--link-hover);
	font-weight: 700;
	z-index: 100000;
}

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

/* Home page theme grid: modest cut-out icons, like the original icon bar. */
.ol-tiles--themes {
	grid-template-columns: repeat(auto-fit, minmax(0, min(8rem, calc(33% - 0.625rem))));
	gap: var(--wp--preset--spacing--20);
}

.ol-tiles--themes .ol-tile__image {
	width: 64px;
	height: 64px;
	margin-inline: auto;
	border: 0;
	background: none;
	object-fit: contain;
}

.ol-tiles--themes .ol-tile__label {
	font-family: var(--wp--preset--font-family--sans);
	font-style: normal;
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
}

.ol-section__intro {
	margin: 0 auto var(--wp--preset--spacing--40);
}

.ol-section__intro .iels-ol-swf {
	margin-inline: auto;
}
