/*
 * Parrisology theme styles. Colors, type and spacing come from theme.json
 * presets; this file only covers what theme.json cannot express.
 */

/* ---------- Focus and accessibility ---------- */
:where(a, button, input, select, textarea, summary, .wp-element-button):focus-visible {
	outline: 3px solid var(--wp--preset--color--terracotta-deep);
	outline-offset: 3px;
	border-radius: 4px;
}

/* Focus rings on dark panels and the footer need a light color to stay visible. */
:where(.has-mocha-background-color, .has-espresso-background-color, .has-sage-background-color, .has-terracotta-deep-background-color)
	:where(a, button, .wp-element-button):focus-visible {
	outline-color: var(--wp--preset--color--cream);
}

/* ---------- Logo ---------- */
.pp-logo {
	margin: 0;
	line-height: 0;
}

.pp-logo img {
	border-radius: 0;
	width: clamp(130px, 28vw, 180px) !important;
	height: auto;
}

/* ---------- Outline button style (secondary action, e.g. "Paperback on Amazon") ---------- */
.wp-block-button.is-style-outline > .wp-block-button__link,
.wp-block-button.is-style-outline > .wp-block-button__link:not(:hover) {
	background: transparent;
	color: var(--wp--preset--color--espresso);
	border: 2px solid var(--wp--preset--color--espresso);
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover,
.wp-block-button.is-style-outline > .wp-block-button__link:focus-visible {
	background: var(--wp--preset--color--espresso);
	color: var(--wp--preset--color--cream);
}

/* ---------- Rounded surfaces ---------- */
.pp-panel,
.pp-tile,
.pp-card {
	border-radius: var(--wp--custom--radius--large);
	overflow: hidden;
}

/* Intro illustration: already round with transparent corners. */
.pp-intro-photo img {
	border-radius: 0;
	width: min(280px, 70vw) !important;
	height: auto;
}

/* Intro text: centered on wider screens, left-aligned on phones for easier reading. */
@media (max-width: 767px) {
	.pp-intro p.has-text-align-center {
		text-align: left;
	}
	.pp-intro p.pp-intro-more { text-align: center; }
}

/* ---------- Hero mosaic ----------
 * Phone/tablet: headline, then the showcase (square).
 * Desktop: headline and showcase side by side.
 */
.pp-mosaic {
	display: grid;
	gap: var(--wp--preset--spacing--30);
	grid-template-columns: minmax(0, 1fr);
}

/* The group's default layout adds block-gap margins; the grid gap replaces them. */
.pp-mosaic > * {
	margin-block: 0 !important;
}

.pp-panel {
	position: relative;
}

@media (min-width: 1024px) {
	.pp-mosaic {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		align-items: stretch;
	}

	.pp-panel--headline {
		min-height: 32rem;
	}
}

/* ---------- Showcase (hero carousel) ----------
 * Crossfades between slides. Without JavaScript only the first slide shows.
 * Autoplay rules live in showcase.js; the fade is skipped for reduced motion.
 */
.pp-showcase,
.pp-showcase__slides {
	position: relative;
	height: 100%;
}

.pp-showcase__slides {
	aspect-ratio: 1;
}

@media (min-width: 1024px) {
	.pp-showcase__slides {
		aspect-ratio: auto;
		min-height: 32rem;
	}
}

.pp-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.7s ease, visibility 0s linear 0.7s;
}

.pp-slide.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.7s ease, visibility 0s;
}

@media (prefers-reduced-motion: reduce) {
	.pp-slide,
	.pp-slide.is-active {
		transition: none;
	}
}

.pp-slide__link {
	display: block;
	height: 100%;
	color: var(--wp--preset--color--espresso);
	text-decoration: none;
}

.pp-slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.pp-slide__caption {
	position: absolute;
	left: var(--wp--preset--spacing--30);
	right: var(--wp--preset--spacing--30);
	bottom: var(--wp--preset--spacing--30);
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	padding: 0.75rem 1.1rem;
	border-radius: var(--wp--custom--radius--medium);
	background: rgb(250 246 240 / 0.94);
	box-shadow: 0 0.5rem 1.25rem -0.75rem rgb(43 33 28 / 0.45);
	line-height: 1.3;
}

.pp-slide__caption strong {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 800;
}

.pp-slide__caption span {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--mocha);
}

.pp-slide__link:hover .pp-slide__caption strong,
.pp-slide__link:focus-visible .pp-slide__caption strong {
	text-decoration: underline;
}

/* Controls are created by showcase.js, so they never appear without it. */
.pp-showcase__controls {
	position: absolute;
	top: var(--wp--preset--spacing--30);
	right: var(--wp--preset--spacing--30);
	z-index: 2;
	display: flex;
	gap: 0.4rem;
}

.pp-showcase__btn {
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 800;
	min-height: 2.5rem;
	padding: 0.4em 0.95em;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--espresso);
	box-shadow: 0 0.25rem 0.75rem -0.4rem rgb(43 33 28 / 0.5);
	cursor: pointer;
}

.pp-showcase__btn:hover {
	background: var(--wp--preset--color--espresso);
	color: var(--wp--preset--color--cream);
}

.pp-showcase__btn[hidden] {
	display: none;
}

/* ---------- Book tiles ---------- */
.pp-tile__cover {
	display: block;
	line-height: 0;
}

.pp-tile__cover img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 4;
	object-fit: contain;
	border-radius: var(--wp--custom--radius--medium);
}

.pp-tile h3 a {
	color: inherit;
	text-decoration: none;
}

.pp-tile h3 a:hover {
	text-decoration: underline;
}

.pp-tile__price {
	margin: 0;
	font-weight: 800;
	font-size: var(--wp--preset--font-size--large);
}

/* Push the buttons to the bottom so tiles in a row line up. */
.pp-tile__actions {
	margin-top: auto !important;
}

/* ---------- Journal cards ---------- */
.pp-card .wp-block-post-featured-image {
	margin: 0;
}

.pp-card .wp-block-post-featured-image img {
	border-radius: 0;
}

/* About page: story paragraphs read left-aligned at every width. */
.pp-story p:not(.has-text-align-center) { text-align: left; }
.pp-intro-more a { font-weight: 700; }
