/**
 * Plenitude Magazine: global styles that theme.json cannot express.
 *
 * Values come from docs/design-system.md. Colors, font sizes, spacing and shadows are theme.json presets:
 * the tokens below point to them, so a change in Appearance → Editor → Styles reaches this file too.
 * Per-block styles are in assets/css/blocks and load only where the block is used.
 */

/* -------------------------------------------------------------------------
 * Tokens
 * ---------------------------------------------------------------------- */

:root {
	/* Colors */
	--pln-color-yellow: var(--wp--preset--color--yellow, #ffcd00);
	--pln-color-light-green: var(--wp--preset--color--light-green, #95b849);
	--pln-color-accessible-green: var(--wp--preset--color--accessible-green, #008051);
	--pln-color-mysolarfamily: var(--wp--preset--color--mysolarfamily, #ff6900);
	--pln-color-text: var(--wp--preset--color--text, #333333);
	--pln-color-text-dark: var(--wp--preset--color--text-dark, #444444);
	--pln-color-text-medium: var(--wp--preset--color--text-medium, #767676);
	--pln-color-text-light: var(--wp--preset--color--text-light, #eaeaea);
	--pln-color-white: var(--wp--preset--color--white, #ffffff);
	--pln-color-bg-grey: var(--wp--preset--color--grey, #f4f4f4);
	--pln-color-bg-future-grey: var(--wp--preset--color--future-grey, #f1f5f4);
	--pln-color-bg-friendly-beige: var(--wp--preset--color--friendly-beige, #faf8f5);
	--pln-color-bg-dark: #333333;
	--pln-color-alert-red: var(--wp--preset--color--alert-red, #d0021b);
	--pln-color-ruby-red: #9d151c;
	--pln-color-lavender-blush: #fcedee;
	--pln-color-forest-green: var(--wp--preset--color--forest-green, #00613d);
	--pln-color-platinum: var(--wp--preset--color--platinum, #eaf2ef);
	--pln-color-hover: #f0f0f0;

	/* Category: fallback, overridden by the .pln-category-{id} rules of the Fields plugin. */
	--pln-category-color: var(--pln-color-mysolarfamily);
	--pln-category-on-color: #333333;

	/* Gradients used outside the presets */
	--pln-gradient-brand-line: var(--wp--preset--gradient--green-oblique-top-right-light);
	--pln-gradient-search-border: var(--wp--preset--gradient--green-horizontal-right-dark);

	/* Grid: XS values, overridden per breakpoint */
	--pln-grid-columns: 4;
	--pln-grid-gutter: 16px;
	--pln-grid-margin: 16px;
	--pln-grid-max-width: 1140px;

	/* Borders and radii */
	--pln-border-width: 1px;
	--pln-border-width-active: 2px;
	--pln-border-color: var(--pln-color-text);
	--pln-radius-s: 4px;
	--pln-radius-focus: 6px;
	--pln-radius-card: 16px;
	--pln-radius-pill: 24px;

	/* Shadows */
	--pln-elevation-1: var(--wp--preset--shadow--elevation-1, 0 0 15px rgb(51 51 51 / 0.15));
	--pln-elevation-2: var(--wp--preset--shadow--elevation-2, 0 0 15px rgb(51 51 51 / 0.3));
	--pln-elevation-3: var(--wp--preset--shadow--elevation-3, 0 0 15px rgb(51 51 51 / 0.15), 0 15px 30px -10px rgb(51 51 51 / 0.3));

	/* Icons, used as mask-image so they take currentColor. Absolute URLs from Assets::icon_urls(). */
	--pln-icon-chevron-right: var(--wp--custom--icon--chevron-right);
	--pln-icon-chevron-left: var(--wp--custom--icon--chevron-left);
	--pln-icon-chevron-down: var(--wp--custom--icon--chevron-down);
	--pln-icon-arrow-right: var(--wp--custom--icon--arrow-right);
	--pln-icon-arrow-left: var(--wp--custom--icon--arrow-left);
	--pln-icon-search: var(--wp--custom--icon--search);
	--pln-icon-send: var(--wp--custom--icon--send);
	--pln-icon-menu: var(--wp--custom--icon--menu);
	--pln-icon-close: var(--wp--custom--icon--close);
	--pln-icon-external-link: var(--wp--custom--icon--external-link);
	--pln-icon-quote-open: var(--wp--custom--icon--quote-open);
	--pln-icon-bullet-point: var(--wp--custom--icon--bullet-point);
}

@media (min-width: 768px) {
	:root {
		--pln-grid-columns: 6;
		--pln-grid-gutter: 24px;
		--pln-grid-margin: 24px;
	}
}

@media (min-width: 1024px) {
	:root {
		--pln-grid-columns: 12;
		--pln-grid-margin: 32px;
	}
}

/* Gap between text and chevron of the Link CTA: registered so that it animates, and the yellow highlight
   (sized from it) keeps the width of the text while the chevron moves. */
@property --pln-cta-gap {
	syntax: "<length>";
	inherits: false;
	initial-value: 8px;
}

/* -------------------------------------------------------------------------
 * Base
 * ---------------------------------------------------------------------- */

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* Sections are stacked with no gap: each one has its own background and padding. */
.wp-site-blocks > * + *,
main.wp-block-group > * + * {
	margin-block-start: 0;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
	word-wrap: normal !important;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--pln-color-text);
	outline-offset: 4px;
}

:where(.wp-block-post-content, .wp-block-term-description, .wp-block-comment-content) a:hover {
	text-decoration-thickness: 2px;
}

.pln-icon {
	display: inline-block;
	flex: none;
	width: 24px;
	height: 24px;
	fill: currentColor;
}

/* Paragraph style Lead (Lead/3). */
.is-style-lead {
	font-size: 18px;
	font-weight: 600;
	line-height: 26px;
}

/* Heading style Section title: Title/2, Accessible Green on home and archives. */
.wp-block-heading.is-style-section-title {
	font-size: var(--wp--preset--font-size--xx-large);
	line-height: calc(1em + 8px);
}

.wp-block-heading.is-style-section-title:not(.has-text-color) {
	color: var(--pln-color-accessible-green);
}

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

.pln-header {
	position: relative;
	z-index: 20;
}

.pln-header__top {
	display: none;
}

.pln-header__main {
	box-shadow: var(--pln-elevation-1);
}

.pln-header__bar {
	min-height: 52px;
	gap: 16px;
}

.pln-header__actions {
	gap: 16px;
}

.pln-header__logo img {
	width: auto !important;
	height: 30px;
	object-fit: contain;
}

/*
 * Text next to the logo: Lead/4 on mobile, Lead/2 from 1024 px. Not in the Figma design.
 * Orange My Solar Family by request: 2.89:1 on white, below the WCAG minimum even for large text.
 */
.pln-header__brand {
	min-width: 0;
}

.pln-header__tagline {
	margin: 0;
	color: var(--pln-color-mysolarfamily);
	font-size: 16px;
	font-weight: 600;
	line-height: 24px;
	white-space: nowrap;
}

@media (min-width: 1024px) {
	.pln-header__tagline {
		font-size: 20px;
		line-height: 28px;
	}
}

/* Editor: the resizable box of the Site Logo block follows the image, not the width attribute. */
:is(.pln-header__logo, .pln-footer__logo) .components-resizable-box__container {
	width: auto !important;
	height: auto !important;
}

@media (min-width: 1024px) {
	.pln-header__top {
		display: block;
	}

	.pln-header__top > * {
		min-height: 48px;
		display: flex;
		align-items: flex-end;
	}

	.pln-header__bar {
		min-height: 80px;
		gap: 24px;
	}

	.pln-header__actions {
		gap: 24px;
	}

	.pln-header__logo img {
		height: 52px;
	}
}

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

.pln-footer {
	background: var(--pln-color-bg-friendly-beige);
}

/* Line break in the company name only while the footer has more than one column (core Columns stack below 782 px). */
.pln-footer__break {
	display: none;
}

@media (min-width: 782px) {
	.pln-footer__break {
		display: inline;
	}
}

.pln-footer__logo,
.pln-footer__bottom {
	position: relative;
}

.pln-footer__logo::before,
.pln-footer__bottom::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 4px;
	background: var(--pln-gradient-brand-line);
}

.pln-footer__logo .wp-block-image {
	margin: 0;
}

.pln-footer__logo img {
	display: block;
	width: auto !important;
	height: 52px;
	object-fit: contain;
}

.pln-footer__title {
	margin: 0;
	color: var(--pln-color-accessible-green);
	font-size: 14px;
	font-weight: 600;
	line-height: 18px;
	text-transform: uppercase;
}

.pln-footer .wp-block-navigation {
	font-size: 14px;
	line-height: 18px;
}

.pln-footer__legal .wp-block-navigation-item__content {
	text-transform: uppercase;
}

.pln-footer__copyright {
	color: var(--pln-color-text-medium);
}

/* -------------------------------------------------------------------------
 * Hero_Small and Band_Standard (core/cover)
 * ---------------------------------------------------------------------- */

/* Content in a 558 px column, aligned to the left edge of the 1140 px focus area. */
.wp-block-cover:is(.pln-hero, .pln-band) {
	padding-inline: var(--pln-grid-margin);
}

.wp-block-cover.wp-block-cover:is(.pln-hero, .pln-band).has-custom-content-position .wp-block-cover__inner-container {
	width: 100%;
}

.wp-block-cover:is(.pln-hero, .pln-band) .wp-block-cover__inner-container > * {
	max-width: 558px;
	margin-inline: max(0px, calc((100% - var(--wp--style--global--content-size, 1140px)) / 2)) auto !important;
}

/* Headings on dark covers follow the cover text color, not the global heading color. */
.wp-block-cover:not(.is-light) :where(h1, h2, h3, h4, h5, h6):not(.has-text-color) {
	color: inherit;
}

@media (max-width: 767px) {
	.wp-block-cover.pln-hero,
	.wp-block-cover.pln-band {
		min-height: 260px !important;
	}

	.wp-block-cover.pln-band {
		padding-block: 24px !important;
	}
}

/* -------------------------------------------------------------------------
 * Archive and page header: Future Grey, or Hero_Small when the term or the page has a featured image
 * ---------------------------------------------------------------------- */

.pln-archive-header {
	position: relative;
	isolation: isolate;
	background: var(--pln-color-bg-future-grey);
}

.pln-archive-header__content {
	position: relative;
	z-index: 1;
}

.pln-archive-header :is(.wp-block-query-title, .wp-block-post-title) {
	color: var(--pln-color-accessible-green);
}

/* Decorative bar in the category color: category archives only, tags have no color. */
body.category .pln-archive-header::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	z-index: 2;
	height: 4px;
	background: var(--pln-category-color);
}

.pln-archive-header:has(:is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image)) {
	display: flex;
	flex-direction: column;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	background: var(--pln-color-white);
}

.pln-archive-header:has(:is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image)) .pln-archive-header__content {
	order: 1;
	margin-block-start: 0;
	padding-block: 32px 24px;
}

.pln-archive-header:has(:is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image)) :is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image) {
	order: 2;
	width: auto;
	max-width: none !important;
	margin-inline: calc(var(--pln-grid-margin) * -1) !important;
	aspect-ratio: 18 / 13;
}

/* Full bleed image: no radius, unlike the post featured images elsewhere (theme.json). */
.pln-archive-header :is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image),
.pln-archive-header :is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image) img {
	border-radius: 0;
}

.pln-archive-header :is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image) img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (min-width: 768px) {
	.pln-archive-header:has(:is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image)) {
		display: block;
		min-height: 400px;
		color: var(--pln-color-white);
	}

	.pln-archive-header:has(:is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image)) .pln-archive-header__content {
		padding-block: 64px 32px;
	}

	.pln-archive-header:has(:is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image)) .pln-archive-header__content > * {
		max-width: 558px;
		margin-inline-start: 0 !important;
	}

	.pln-archive-header:has(:is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image)) :is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image) {
		position: absolute;
		inset: 0;
		z-index: -1;
		margin: 0 !important;
		max-width: none !important;
		aspect-ratio: auto;
	}

	/* Dark overlay for the contrast of the white text (open point 4 of the design system). */
	.pln-archive-header:has(:is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image))::after {
		content: "";
		position: absolute;
		inset: 0;
		z-index: 0;
		background: var(--wp--preset--gradient--black-horizontal-left);
	}

	.pln-archive-header:has(:is(.wp-block-plenitude-magazine-term-featured-image, .wp-block-post-featured-image)) :is(.wp-block-query-title, .wp-block-post-title) {
		color: var(--pln-color-white);
	}
}

/* Pages after the first: title only (Figma 1:12216, 176 px), image as background at every width. */
body.paged .pln-archive-header:has(.wp-block-plenitude-magazine-term-featured-image) {
	display: block;
	min-height: 0;
	padding-top: var(--wp--preset--spacing--45) !important;
	padding-bottom: var(--wp--preset--spacing--45) !important;
	color: var(--pln-color-white);
}

body.paged .pln-archive-header:has(.wp-block-plenitude-magazine-term-featured-image) .pln-archive-header__content {
	padding-block: 0;
}

body.paged .pln-archive-header:has(.wp-block-plenitude-magazine-term-featured-image) .pln-archive-header__content > * {
	max-width: 558px;
	margin-inline-start: 0 !important;
}

body.paged .pln-archive-header:has(.wp-block-plenitude-magazine-term-featured-image) .wp-block-plenitude-magazine-term-featured-image {
	position: absolute;
	inset: 0;
	z-index: -1;
	margin: 0 !important;
	max-width: none !important;
	aspect-ratio: auto;
}

body.paged .pln-archive-header:has(.wp-block-plenitude-magazine-term-featured-image)::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background: var(--wp--preset--gradient--black-horizontal-left);
}

body.paged .pln-archive-header:has(.wp-block-plenitude-magazine-term-featured-image) .wp-block-query-title {
	color: var(--pln-color-white);
}

/* -------------------------------------------------------------------------
 * Cards
 * ---------------------------------------------------------------------- */

/* Card_Blog (section style Card): link at the bottom, title links without underline. */
.is-style-card,
.is-style-card-listing {
	height: 100%;
	box-sizing: border-box;
	overflow: hidden;
}

.is-style-card > .wp-block-read-more,
.is-style-card > .wp-block-buttons,
.is-style-card-listing .wp-block-read-more {
	margin-top: auto;
}

.is-style-card .wp-block-post-featured-image img {
	border-radius: var(--pln-radius-card);
}

/* Card_Article (section style Card listing): image full bleed, radius on top only. */
.is-style-card-listing .wp-block-post-featured-image,
.is-style-card-listing .wp-block-post-featured-image img {
	border-radius: var(--pln-radius-card) var(--pln-radius-card) 0 0;
}

.is-style-card-listing > :not(.wp-block-post-featured-image) {
	padding-inline: 16px;
}

/* Card_Image: core/cover with the featured image. */
.pln-card-image.wp-block-cover {
	height: 100%;
	border-radius: var(--pln-radius-card);
	box-shadow: var(--pln-elevation-1);
	overflow: hidden;
}

.pln-card-image .wp-block-cover__inner-container {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.pln-card-image .wp-block-post-title {
	color: var(--pln-color-white);
}

.pln-card-image .wp-block-post-title a {
	color: inherit;
}

.pln-card-image .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.pln-card-image .wp-block-read-more {
	position: relative;
	z-index: 2;
}

/* Card_Standard (longform): text box over the image by 16 px. */
.pln-card-standard {
	height: 100%;
	box-shadow: var(--pln-elevation-1);
	border-radius: var(--pln-radius-card);
	background: var(--pln-color-white);
	overflow: hidden;
}

.pln-card-standard > .wp-block-image {
	margin: 0;
}

.pln-card-standard > .wp-block-image img {
	width: 100%;
	height: 160px;
	object-fit: cover;
	border-radius: var(--pln-radius-card) var(--pln-radius-card) 0 0;
}

.pln-card-standard__body {
	position: relative;
	margin-top: -16px !important;
	border-radius: var(--pln-radius-card);
	background: var(--pln-color-white);
	color: var(--pln-color-text);
}

/* List_Summary (longform): icon, title and text. */
.pln-list-summary__item {
	padding-inline: 32px;
}

.pln-list-summary__item .wp-block-image {
	flex: none;
	margin: 0;
}

/* -------------------------------------------------------------------------
 * Article contents
 * ---------------------------------------------------------------------- */

.wp-block-post-content > h2 {
	margin-block: 48px 16px;
}

.wp-block-post-content > h3 {
	margin-block: 32px 8px;
}

.wp-block-post-content > h4 {
	margin-block: 24px 8px;
}

.wp-block-post-content > h5,
.wp-block-post-content > h6 {
	margin-block: 16px 8px;
}

.wp-block-post-content > :first-child {
	margin-block-start: 0;
}

.wp-block-post-content :where(strong, b) {
	font-weight: 600;
}

.wp-block-post-content > .alignfull.wp-block-pullquote,
.wp-block-post-content > .alignfull.has-background {
	margin-block: 48px;
}

.wp-block-embed .wp-block-embed__wrapper {
	overflow: hidden;
	border-radius: var(--pln-radius-card);
}

.wp-block-image figcaption,
.wp-block-embed figcaption {
	margin-bottom: 0;
}

/* Gallery: same radius as the other images. */
.wp-block-gallery .wp-block-image img {
	border-radius: var(--pln-radius-card);
}

/* -------------------------------------------------------------------------
 * Single post
 * ---------------------------------------------------------------------- */

.pln-post-header .wp-block-post-title {
	margin: 0;
}

.pln-post-header .wp-block-post-date {
	margin-block: 8px 16px;
}

/* Comments: the section disappears when the post has no comments. */
.pln-comments-section:not(:has(.wp-block-comment-template)) {
	display: none;
}

/* Breadcrumb: the section disappears without Yoast SEO. From 1024 px the padding is 16 px. */
.pln-breadcrumbs:not(:has(.yoast-breadcrumbs)) {
	display: none;
}

@media (min-width: 1024px) {
	.pln-breadcrumbs {
		padding-block: 16px !important;
	}
}

/* Home and archives: a Query Loop or Terms Query section disappears when it has no posts or terms. */
.pln-hide-if-empty:not(:has(.wp-block-post, .wp-block-term)) {
	display: none;
}
