/*
Theme Name: Magpie
Theme URI: https://example.com/magpie
Author: Marco Martins
Author URI: https://example.com
Description: Magpie is a child theme of Twenty Twenty-Five.
Template: twentytwentyfive
Requires at least: 6.7
Requires PHP: 7.2
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: magpie
*/

/*
 * Single book.
 *
 * Mirrors the books table block: hairlines and muted text mixed from
 * currentcolor, 12px panels, and small uppercase labels.
 */
.magpie-book {
	--book-line: color-mix(in srgb, currentcolor 12%, transparent);
	--book-muted: color-mix(in srgb, currentcolor 65%, transparent);
	--book-tint: color-mix(in srgb, currentcolor 3%, transparent);
	--book-radius: 12px;
}

.magpie-book a {
	color: inherit;
	text-decoration-color: var(--book-line);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	transition: text-decoration-color 0.15s ease;
}

.magpie-book a:hover,
.magpie-book a:focus-visible {
	text-decoration-color: currentcolor;
}

/* Cover */
.magpie-book__cover {
	align-self: flex-start;
}

@media (min-width: 782px) {

	.magpie-book__cover {
		position: sticky;
		top: var(--wp--preset--spacing--50);
	}
}

.magpie-book__cover .wp-block-post-featured-image {
	margin: 0;
	padding: 2rem 1.5rem;
	background: color-mix(in srgb, currentcolor 6%, transparent);
	border: 1px solid var(--book-line);
	border-radius: var(--book-radius);
}

.magpie-book__cover .wp-block-post-featured-image img {
	display: block;
	width: 75%;
	max-width: 16rem;
	height: auto;
	margin-inline: auto;
	border-radius: 2px;
	box-shadow:
		0 1px 2px rgb(0 0 0 / 15%),
		0 8px 18px -6px rgb(0 0 0 / 30%);
}

/* Title, subtitle, and authors */
.magpie-book__header {
	display: grid;
	gap: 0.5rem;
}

.magpie-book__header > * {
	margin-block: 0;
}

.magpie-book__header .wp-block-post-title {
	font-weight: 400;
	line-height: 1.15;
}

.magpie-book__subtitle {
	color: var(--book-muted);
}

.magpie-book__subtitle:empty {
	display: none;
}

.magpie-book__authors {
	margin-block-start: 0.5rem;
}

/* Details */
.magpie-book__details {
	margin-block-start: var(--wp--preset--spacing--40);
	font-size: 0.9375rem;
	line-height: 1.45;
	font-variant-numeric: tabular-nums;
}

.magpie-book__details > * {
	margin-block: 0;
}

.magpie-book__details .magpie-book__row {
	gap: 0.35em;
	align-items: baseline;
	padding-block: 0.875rem;
	border-block-end: 1px solid var(--book-line);
}

.magpie-book__details .magpie-book__row:first-child {
	padding-block-start: 0;
}

.magpie-book__details .magpie-book__row:last-child {
	border-block-end: 0;
}

.magpie-book__label {
	flex: 0 0 9rem;
	margin: 0 0.65rem 0 0;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--book-muted);
}

.magpie-book__value {
	min-width: 0;
	margin: 0;
}

.magpie-book__secondary {
	color: var(--book-muted);
}

/* Notes */
.magpie-book__notes {
	display: grid;
	gap: 0.5rem;
	margin-block-start: 0;
	padding-block-start: 0.875rem;
	font-size: 0.9375rem;
	line-height: 1.6;
	border-block-start: 1px solid var(--book-line);
}

.magpie-book__notes > * {
	margin-block: 0;
}

.magpie-book__notes .magpie-book__value {
	max-width: 65ch;
}

/* No notes: hide the section, label included. */
.magpie-book__notes:has(> .magpie-book__value:empty) {
	display: none;
}

@media (max-width: 600px) {

	.magpie-book__details .magpie-book__row {
		flex-wrap: wrap;
	}

	.magpie-book__label {
		flex-basis: 100%;
	}
}

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

	.magpie-book a {
		transition: none;
	}
}
