/* Konisto v3 — WordPress glue.
 *
 * konisto.css is the design package's stylesheet and is kept byte-for-byte as
 * delivered, so a revised design can be dropped straight back in. Everything
 * WordPress needs that a static prototype could not know about lives here:
 * the alignment and caption classes 592 articles of author-written HTML use,
 * the step images, the image credits line, and pagination.
 *
 * It loads after konisto.css and reuses its custom properties, so there is one
 * set of tokens, not two.
 */

/* --- Content written in the editor ------------------------------------- */

.lede img,
.step img,
.sheet .wp-caption img {
	max-width: 100%;
	height: auto;
}

.alignleft {
	float: left;
	margin: 6px 24px 16px 0;
}

.alignright {
	float: right;
	margin: 6px 0 16px 24px;
}

.aligncenter {
	display: block;
	margin-inline: auto;
}

.alignnone {
	margin: 6px 0 16px;
}

/* A float beside 66ch of text leaves too little room on a phone. */
@media (max-width: 719px) {

	.alignleft,
	.alignright {
		float: none;
		display: block;
		margin: 16px 0;
	}
}

.wp-caption {
	max-width: 100%;
	margin-bottom: 20px;
}

.wp-caption-text,
.wp-element-caption {
	margin-top: 8px;
	font-family: var(--sans);
	font-size: 14px;
	line-height: 1.5;
	color: var(--muted);
}

.lede ul,
.lede ol,
.step ul,
.step ol {
	max-width: 66ch;
	margin: 0 0 20px;
	padding-left: 22px;
	font-size: 18px;
	line-height: 1.7;
}

.lede li,
.step li {
	margin-bottom: 8px;
}

.lede blockquote,
.step blockquote {
	max-width: 64ch;
	margin: 0 0 20px;
	padding: 4px 0 4px 20px;
	border-left: 3px solid var(--sand-200);
	color: var(--muted);
	font-style: italic;
}

.lede table,
.step table {
	width: 100%;
	margin-bottom: 20px;
	border-collapse: collapse;
	font-family: var(--sans);
	font-size: 16px;
}

.lede th,
.lede td,
.step th,
.step td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--sand-200);
	text-align: left;
}

.lede th,
.step th {
	font-weight: 700;
}

/* Author HTML contains <code> blocks; the old theme ran them through a
   prettify library that is no longer loaded, so they are simply readable. */
.lede pre,
.step pre {
	max-width: 100%;
	margin-bottom: 20px;
	padding: 16px;
	overflow-x: auto;
	background: var(--paper);
	border: 1px solid var(--sand-200);
	font-size: 14px;
	line-height: 1.6;
}

.lede code,
.step code {
	font-size: 0.94em;
}

.lede iframe,
.step iframe,
.lede embed,
.step embed {
	max-width: 100%;
}


/* --- Step images and their credits -------------------------------------- */

.step-image {
	display: block;
	width: 100%;
	height: auto;
	margin-top: 4px;
}

.image-credits {
	margin-top: -6px;
	font-family: var(--sans);
	font-size: 13px;
	line-height: 1.5;
	color: var(--muted);
}

.image-credits a {
	color: inherit;
	text-decoration: underline;
}


/* --- Pagination ---------------------------------------------------------- */

.pager {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--sand-200);
}

.pager .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	justify-content: center;
}

.pager .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid var(--edge);
	background: var(--surface);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 16px;
	text-decoration: none;
	transition: background 200ms ease, border-color 200ms ease;
}

.pager a.page-numbers:hover,
.pager a.page-numbers:focus-visible {
	background: var(--paper);
	border-color: var(--ink);
}

.pager .page-numbers.current {
	background: var(--red-strong);
	border-color: var(--red-strong);
	color: #fff;
	font-weight: 700;
}

.pager .page-numbers.dots {
	border-color: transparent;
	min-width: 0;
	padding: 0 4px;
}

@media (prefers-reduced-motion: reduce) {

	.pager .page-numbers {
		transition: none;
	}
}


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

/* WordPress core and several plugins emit this class; the design's own
   visually-hidden helper is .sr, so both need to behave the same. */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	z-index: 100000;
	top: 8px;
	left: 8px;
	width: auto;
	height: auto;
	padding: 12px 20px;
	clip-path: none;
	background: var(--surface);
	color: var(--ink);
	font-family: var(--sans);
	text-decoration: underline;
}


/* --- Top bar category panel ---------------------------------------------
 *
 * Restores the preview the old top bar had: hovering a category opens its
 * sub-categories beside a preview of three articles, and hovering a
 * sub-category swaps the preview to that one.
 *
 * Opened with :hover and :focus-within rather than by script, so the links
 * work by keyboard and without JavaScript; only the preview column is filled
 * by konisto-nav.js.
 */

.nav__item {
	display: flex;
}

/* Hover opens the panel on desktop, so the phone disclosure has no job here. */
.nav__toggle {
	display: none;
}

/* The panel's BACKGROUND spans the whole viewport while its CONTENT stays in
 * the content column, so the open menu reads as a band across the page rather
 * than a floating card. That needs two elements and the right containing
 * block: .topbar is full width, so the panel is positioned against it, and
 * .nav__panel-in re-applies the .wrap measurements inside. */
.topbar {
	position: relative;
}

/* The bar must stay above the hero photo for the panel to sit over it. */
.topbar {
	position: relative;
	z-index: 20;
}

.nav__panel {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 30;
	background: var(--surface);
	border-top: 1px solid var(--sand-200);
	border-bottom: 1px solid var(--sand-200);
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.16);
}

/* Same measurements as .wrap, so the sub-category list starts exactly where
   the content sheet below it does. */
.nav__panel-in {
	display: grid;
	grid-template-columns: minmax(190px, 240px) 1fr;
	gap: 0;
	max-width: var(--wrap);
	margin: 0 auto;
	padding: 0 var(--gut);
}

.nav__item--has-sub:hover .nav__panel,
.nav__item--has-sub:focus-within .nav__panel {
	display: block;
}

.nav__item--has-sub:hover > .nav__top,
.nav__item--has-sub:focus-within > .nav__top {
	background: var(--surface);
}

.nav__subs {
	margin: 0;
	padding: 8px 0;
	list-style: none;
	background: var(--paper);
	border-right: 1px solid var(--sand-200);
}

.nav__subs a {
	min-height: 40px;
	padding: 0 16px;
	font-family: var(--sans);
	font-size: 14px;
	line-height: 1.3;
	color: var(--ink);
}

.nav__sub.is-active > a,
.nav__subs a:hover,
.nav__subs a:focus-visible {
	background: var(--surface);
	font-weight: 700;
}

.nav__preview {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	min-height: 150px;
	padding: 20px;
	align-content: start;
}

.nav__preview:empty::after,
.nav__preview[data-loading]::after {
	content: "";
	grid-column: 1 / -1;
	min-height: 118px;
	background: var(--paper);
}

.nav-prev__card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-height: 0;
	padding: 0;
	text-decoration: none;
	color: var(--ink);
}

.nav-prev__img {
	display: block;
	overflow: hidden;
	background: var(--paper);
}

.nav-prev__img img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 240ms var(--ease-out, ease);
}

.nav-prev__card:hover .nav-prev__img img {
	transform: scale(1.03);
}

.nav-prev__title {
	font-family: var(--serif);
	font-size: 15px;
	line-height: 1.3;
	text-wrap: pretty;
}

@media (prefers-reduced-motion: reduce) {

	.nav-prev__img img {
		transition: none;
	}

	.nav-prev__card:hover .nav-prev__img img {
		transform: none;
	}
}

/* Phone: the bar becomes a full-width list, so the panel cannot hover. The
 * sub-categories are shown inline as an indented list and the preview is
 * dropped - three article cards per category would bury the menu. */
@media (max-width: 719px) {

	/* Row, not column: the label and its disclosure share one 48px line, and
	   the panel wraps below because it is full width. */
	.nav__item {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: stretch;
		width: 100%;
	}

	/* Each category is one 48px row until its disclosure is tapped; showing
	   every sub-category at once made the open menu 1900px tall. */
	.nav__top {
		flex: 1 1 auto;
		width: auto;
	}

	.nav__toggle {
		display: flex;
		flex: none;
		align-items: center;
		justify-content: center;
		width: 48px;
		min-height: 48px;
		padding: 0;
		background: none;
		border: 0;
		border-bottom: 1px solid var(--surface);
		cursor: pointer;
	}

	.nav__toggle span[aria-hidden] {
		display: block;
		width: 9px;
		height: 9px;
		border-right: 2px solid var(--ink);
		border-bottom: 2px solid var(--ink);
		transform: translateY(-2px) rotate(45deg);
		transition: transform 160ms ease;
	}

	.nav__item.is-expanded .nav__toggle span[aria-hidden] {
		transform: translateY(2px) rotate(225deg);
	}

	.nav__panel {
		display: none;
		position: static;
		width: 100%;
		border: 0;
		box-shadow: none;
		background: transparent;
	}

	.nav__panel-in {
		display: block;
		max-width: none;
		margin: 0;
		padding: 0;
	}

	.nav__item.is-expanded .nav__panel {
		display: block;
	}

	.nav__subs {
		padding: 0 0 8px 16px;
		background: transparent;
		border-right: 0;
	}

	.nav__subs a {
		min-height: 44px;
		font-size: 15px;
		border-bottom: 1px solid var(--surface);
	}

	.nav__preview {
		display: none;
	}
}


@media (prefers-reduced-motion: reduce) {

	.nav__toggle span[aria-hidden] {
		transition: none;
	}
}


/* --- Hero photographer credit -------------------------------------------
 * Required, not decorative: most of this site's photos are Creative Commons
 * from Flickr, and the licence obliges attribution wherever they are shown.
 * Set over the bottom-right of the photo, quiet enough to stay out of the way
 * and legible enough to count as a credit. */

.hero {
	position: relative;
}

.image-credits.hero__credit {
	position: absolute;
	right: 0;
	/* The content sheet rises --sheet-rise into the photo, so a credit pinned
	   to the hero's bottom edge ends up underneath it. Sit just above that. */
	bottom: calc(var(--sheet-rise, 130px) + 6px);
	z-index: 2;
	max-width: 60%;
	margin: 0;
	padding: 4px 10px;
	background: rgba(0, 0, 0, 0.42);
	color: #fff;
	font-family: var(--sans);
	font-size: 11px;
	line-height: 1.5;
	text-align: right;
}

.image-credits.hero__credit a {
	color: #fff;
	text-decoration: underline;
}

@media (max-width: 719px) {

	.image-credits.hero__credit {
		max-width: 100%;
		font-size: 10px;
		padding: 3px 8px;
	}
}
