/*
Theme Name: QMD Base
Author: Qurrent Media Designs
Author URI: https://qurrentmediadesigns.com/
Description: Shared parent block theme for Qurrent Media Designs sites. Built on WordPress core with no page builder. Each site's look comes from its child theme and its settings, never from here.
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 8.1
Version: 0.1.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: qmd-base
Tags: block-theme, full-site-editing
*/

/*
THE STICKY MENU BAR. On when the site-colours part adds qmd-sticky-header to the page,
which it does unless the client has switched it off. The plugin holds the choice; this
holds the look. Same as Daniel's site, where it was worked out.

It is the outer wrapper that sticks, not the header block. WordPress wraps the header part
in a header of its own exactly as tall as it, and a sticky element cannot leave its own
wrapper (Wade, 2026-10-05, on Daniel's site).

Below the WordPress toolbar when someone is logged in. On a phone that toolbar scrolls
away, so the bar goes to the very top there.
*/
body.qmd-sticky-header .wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
}

@media (max-width: 600px) {
	body.qmd-sticky-header .wp-site-blocks > header.wp-block-template-part {
		top: 0;
	}
}

/* A link to a place on the page (/#contact) stops below the bar, not under it. */
html:has(body.qmd-sticky-header) {
	scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 110px);
}

/* The header and footer sit flush with the page edges and each other. */
.wp-site-blocks > header.wp-block-template-part,
.wp-site-blocks > footer.wp-block-template-part {
	margin-block-start: 0;
}

.qmd-header .wp-block-site-title a,
.qmd-footer a {
	text-decoration: none;
}

/*
THE HERO (qmd/hero, from the hero part). A full-width picture band under the menu bar,
words on the left in the reading column, so they start on the same edge as the text below.
From Daniel's site, where the reasons for each rule are recorded (his D-035 and D-036).
*/
.qmd-hero {
	--qmd-hero-height: 560px;
}

.qmd-hero.wp-block-cover {
	min-height: var(--qmd-hero-height) !important;
	padding-left: 0;
	padding-right: 0;
	margin-block-start: 0;
}

@media (max-width: 899px) {
	.qmd-hero {
		--qmd-hero-height: 420px;
	}
}

@media (max-width: 599px) {
	.qmd-hero {
		--qmd-hero-height: 320px;
	}
}

.qmd-hero .wp-block-cover__inner-container {
	width: min(var(--wp--style--global--content-size), 100% - 32px);
	margin-inline: auto;
	padding-left: 0;
	padding-right: 0;
	color: var(--wp--preset--color--light);
}

.qmd-hero--pale .wp-block-cover__inner-container {
	color: var(--wp--preset--color--contrast);
}

.qmd-hero__headline,
.qmd-hero__line {
	margin-left: 0;
	margin-right: auto;
	color: inherit;
}

.qmd-hero__headline {
	max-width: 16ch;
	font-size: clamp(2rem, 5vw, 3.25rem);
	line-height: 1.1;
}

.qmd-hero__line {
	max-width: 32ch;
	font-size: 1.125rem;
}

.qmd-hero .wp-block-buttons {
	margin-top: 1.5rem;
}

/* The light colour on the dark: the same pair the colours screen checks for the bar. */
.qmd-hero .qmd-hero__button .wp-block-button__link {
	background-color: var(--wp--preset--color--light);
	color: var(--wp--preset--color--dark);
}

.qmd-hero .qmd-hero__button--dark .wp-block-button__link {
	background-color: var(--wp--preset--color--dark);
	color: var(--wp--preset--color--light);
}

.qmd-hero .qmd-hero__button--outline .wp-block-button__link {
	background-color: transparent;
	color: var(--wp--preset--color--light);
	border: 2px solid currentColor;
}

/*
THE HEADER ON A PHONE. The name, the menu button and any header button share one row, so
each gives a little: the name may wrap, the button gets smaller. Nothing may push the page
wider than the screen.
*/
.qmd-header > .wp-block-group {
	gap: 12px;
}

.qmd-header .wp-block-site-title {
	min-width: 0;
}

@media (max-width: 600px) {
	.qmd-header .wp-block-site-title {
		font-size: 1rem;
	}

	.qmd-header .wp-block-button__link {
		padding: 8px 12px;
		font-size: 0.875rem;
		white-space: nowrap;
	}

	.qmd-header .wp-block-group {
		gap: 10px;
	}
}

/* Blog: a long web address in a post wraps rather than widening the page on a phone. */
.qmd-post .wp-block-post-content,
.qmd-blog .wp-block-post-excerpt {
	overflow-wrap: anywhere;
}

/* Opening sections from a page field (a CV): a heading per section, its list underneath,
   a plus that becomes a minus when open. Lines in the text colour, faded. */
.qmd-sections__section {
	border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent);
	padding: 14px 0;
}

.qmd-sections > .qmd-sections__section {
	margin-block: 0;
}

.qmd-sections__section:last-of-type {
	border-bottom: 1px solid color-mix(in srgb, currentColor 25%, transparent);
}

.qmd-sections__section > summary {
	cursor: pointer;
	font-weight: 700;
	list-style: none;
}

.qmd-sections__section > summary::-webkit-details-marker {
	display: none;
}

.qmd-sections__section > summary::after {
	content: "+";
	float: right;
	font-weight: 400;
	line-height: 1;
}

.qmd-sections__section[open] > summary::after {
	content: "\2212";
}

/* A bullet and a gap per entry, so a long section reads as separate items, not one block
   (Gillian, 2026-10-19). */
.qmd-sections__list {
	list-style: disc;
	margin: 14px 0 6px;
	padding-left: 1.25em;
}

.qmd-sections__list li {
	margin-bottom: 12px;
	padding-left: 4px;
}

.qmd-sections__list li:last-child {
	margin-bottom: 0;
}

/* Videos, audio and photos from page fields (the Gallery page first, YYT Y-T14). Functional
   styles only; the look comes in the visual pass. */
.qmd-videos,
.qmd-audio,
.qmd-gallery {
	margin: 0;
	padding: 0;
	list-style: none;
}

.qmd-videos {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
	gap: 24px;
}

.qmd-video {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #000;
}

.qmd-video__play,
.qmd-video__frame {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

.qmd-video__play img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The play button: a dark rounded box with a white triangle, drawn so no icon is loaded. */
.qmd-video__button {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 68px;
	height: 48px;
	margin: -24px 0 0 -34px;
	background: rgba(0, 0, 0, 0.75);
	border-radius: 12px;
	transition: background 0.15s;
}

.qmd-video__button::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -10px 0 0 -7px;
	border-style: solid;
	border-width: 10px 0 10px 18px;
	border-color: transparent transparent transparent #fff;
}

.qmd-video__play:hover .qmd-video__button,
.qmd-video__play:focus-visible .qmd-video__button {
	background: #c00;
}

.qmd-videos__title,
.qmd-audio__title {
	margin: 8px 0 0;
	font-weight: 700;
}

.qmd-audio__item + .qmd-audio__item {
	margin-top: 20px;
}

.qmd-audio__title,
.qmd-audio__by {
	margin: 0 0 6px;
}

.qmd-audio__title + .qmd-audio__by {
	margin-top: -4px;
}

.qmd-audio__player {
	display: block;
	width: 100%;
	max-width: 520px;
}

.qmd-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(45%, 200px), 1fr));
	gap: 12px;
}

.qmd-gallery__link {
	display: block;
}

.qmd-gallery__image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: cover;
}

.qmd-gallery__caption {
	margin: 0;
}

/*
 * Viewers (videos and pictures, layout "viewer"): one large, the rest in a row underneath that
 * slides sideways, about five across, three and a half on a phone so the cut-off one shows
 * there are more. The large picture's frame keeps one shape; a picture fits inside it, uncut.
 */
/* A pictures viewer is also a .qmd-gallery, for the lightbox, but not laid out as its grid. */
.qmd-viewer.qmd-gallery {
	display: block;
}

.qmd-viewer__stage {
	display: block;
}

.qmd-viewer--pictures .qmd-viewer__stage {
	aspect-ratio: 3 / 2;
	background: #000;
}

.qmd-viewer--pictures .qmd-viewer__stage img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.qmd-viewer__title {
	margin: 8px 0 0;
	text-align: center;
}

/* Under a picture: its title, bold, then its caption on its own lines (starter S-025). */
.qmd-picture-words__title,
.qmd-picture-words__details {
	display: block;
}

.qmd-picture-words__title {
	font-weight: 700;
	font-size: 1.1em;
}

.qmd-picture-words__details {
	white-space: pre-line;
	font-size: 0.95em;
}

.qmd-viewer__title:empty {
	display: none;
}

.qmd-viewer__row,
.qmd-viewer > .qmd-viewer__thumbs {
	margin-top: 16px;
}

.qmd-viewer__row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.qmd-viewer__thumbs {
	--qmd-viewer-across: 5;
	display: flex;
	flex: 1;
	min-width: 0;
	gap: 12px;
	margin: 0;
	padding: 4px;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
}

.qmd-viewer__thumbs > li {
	flex: 0 0 calc((100% - (var(--qmd-viewer-across) - 1) * 12px) / var(--qmd-viewer-across));
	scroll-snap-align: start;
}

.qmd-viewer__thumb {
	display: block;
	opacity: 0.7;
	transition: opacity 0.15s;
}

.qmd-viewer__thumb:hover,
.qmd-viewer__thumb:focus-visible,
.qmd-viewer__thumb[aria-current="true"] {
	opacity: 1;
}

.qmd-viewer__thumb[aria-current="true"] {
	outline: 3px solid currentColor;
	outline-offset: -3px;
}

.qmd-viewer__thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.qmd-viewer--pictures .qmd-viewer__thumb img {
	aspect-ratio: 3 / 2;
}

.qmd-viewer__arrow {
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	font-size: 28px;
	line-height: 1;
	color: inherit;
	background: none;
	cursor: pointer;
}

.qmd-viewer__arrow:disabled {
	opacity: 0.3;
	cursor: default;
}

.qmd-viewer__row--fits .qmd-viewer__arrow {
	display: none;
}

/* On a phone the row is swiped, so the arrows give their room back to the pictures. */
@media (max-width: 600px) {
	.qmd-viewer__thumbs {
		--qmd-viewer-across: 3.5;
	}

	.qmd-viewer__arrow {
		display: none;
	}
}

/*
 * Printing: anything marked qmd-no-print stays off the paper, anything marked qmd-print-only
 * shows only there. Used by the calendar page, to print the months with the site's name and
 * contact details but without the menu.
 */
.qmd-print-only {
	display: none;
}

@media print {
	.qmd-no-print {
		display: none !important;
	}

	.qmd-print-only {
		display: block;
	}
}

/*
 * THE FRAME, a QMD standard (components/frame.php in the plugin, which adds .qmd-frame).
 * Light bands from Daniel Colby's site: along the very top, under the header, above the
 * footer, and a thin rule above the footer's last line once there is anything above it.
 */
.qmd-frame .qmd-header {
	border-top: 6px solid var(--wp--preset--color--light);
	border-bottom: 6px solid var(--wp--preset--color--light);
}

.qmd-frame .qmd-footer {
	border-top: 6px solid var(--wp--preset--color--light);
}

.qmd-frame .qmd-footer > * + p:last-child {
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px solid rgba(255, 255, 255, 0.25);
}
