/*
 * Pulse theme: the parts theme.json cannot express.
 * 1. Dark scheme (prefers-color-scheme and the header toggle)
 * 2. Accessibility (focus, skip link, reduced motion)
 * 3. Components (header, cards, live card, contact form, toggle)
 */

/* 1. Dark scheme ---------------------------------------------------------- */

:root {
	color-scheme: light;
	--pulse-danger: #B91C1C;
	--pulse-danger-soft: #FEF2F2;
	--pulse-success-soft: #F0FDFA;
	--pulse-header-bg: rgba(255, 255, 255, 0.82);
	--gp-live-bg: #047857;
	--gp-live-ink: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
	html:not([data-theme="light"]),
	html:not([data-theme="light"]) body {
		color-scheme: dark;
		--wp--preset--color--primary: #FBBF24;
		--wp--preset--color--primary-soft: #3B2A08;
		--wp--preset--color--primary-bright: #FCD34D;
		--wp--preset--color--primary-text: #FBBF24;
		--wp--preset--color--on-primary: #0B0F1A;
		--wp--preset--color--accent: #34D399;
		--wp--preset--color--accent-text: #34D399;
		--wp--preset--color--ink: #E2E8F0;
		--wp--preset--color--muted: #94A3B8;
		--wp--preset--color--surface: #0B0F1A;
		--wp--preset--color--surface-alt: #111827;
		--wp--preset--color--border: #1F2937;
		--wp--preset--gradient--hero: radial-gradient(60rem 30rem at 85% -10%, rgba(251, 191, 36, 0.20), transparent 60%), radial-gradient(40rem 24rem at -5% 110%, rgba(52, 211, 153, 0.10), transparent 60%), linear-gradient(180deg, #0B0F1A 0%, #0B0F1A 100%);
		--wp--preset--gradient--amber-night: linear-gradient(135deg, #92400E 0%, #3B2A08 55%, #0B0F1A 100%);
		--wp--preset--shadow--card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
		--wp--preset--shadow--lifted: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 48px -20px rgba(251, 191, 36, 0.35);
		--pulse-danger: #FCA5A5;
		--pulse-danger-soft: rgba(185, 28, 28, 0.16);
		--pulse-success-soft: rgba(20, 184, 166, 0.14);
		--pulse-header-bg: rgba(11, 15, 26, 0.78);
		--gp-live-bg: #34D399;
		--gp-live-ink: #0B0F1A;
	}
}

html[data-theme="dark"],
html[data-theme="dark"] body {
	color-scheme: dark;
	--wp--preset--color--primary: #FBBF24;
	--wp--preset--color--primary-soft: #3B2A08;
	--wp--preset--color--primary-bright: #FCD34D;
	--wp--preset--color--primary-text: #FBBF24;
	--wp--preset--color--on-primary: #0B0F1A;
	--wp--preset--color--accent: #34D399;
	--wp--preset--color--accent-text: #34D399;
	--wp--preset--color--ink: #E2E8F0;
	--wp--preset--color--muted: #94A3B8;
	--wp--preset--color--surface: #0B0F1A;
	--wp--preset--color--surface-alt: #111827;
	--wp--preset--color--border: #1F2937;
	--wp--preset--gradient--hero: radial-gradient(60rem 30rem at 85% -10%, rgba(251, 191, 36, 0.20), transparent 60%), radial-gradient(40rem 24rem at -5% 110%, rgba(52, 211, 153, 0.10), transparent 60%), linear-gradient(180deg, #0B0F1A 0%, #0B0F1A 100%);
	--wp--preset--gradient--amber-night: linear-gradient(135deg, #92400E 0%, #3B2A08 55%, #0B0F1A 100%);
	--wp--preset--shadow--card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
	--wp--preset--shadow--lifted: 0 2px 4px rgba(0, 0, 0, 0.4), 0 24px 48px -20px rgba(251, 191, 36, 0.35);
	--pulse-danger: #FCA5A5;
	--pulse-danger-soft: rgba(185, 28, 28, 0.16);
	--pulse-success-soft: rgba(20, 184, 166, 0.14);
	--pulse-header-bg: rgba(11, 15, 26, 0.78);
	--gp-live-bg: #34D399;
	--gp-live-ink: #0B0F1A;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	font-feature-settings: "cv11", "ss01", "ss03";
}

::selection {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-primary);
}

a {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	transition: color var(--wp--custom--transition, 180ms ease);
}

a:hover {
	text-decoration-thickness: 2px;
}

:where(code, kbd, samp):not(pre *) {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.875em;
	padding: 0.1em 0.35em;
	border-radius: 6px;
	background: var(--wp--preset--color--surface-alt);
	border: 1px solid var(--wp--preset--color--border);
}

/* 2. Accessibility ------------------------------------------------------- */

/* w15: a two-tone ring (the page colour inside, the primary colour outside), so focus shows on light pages, dark
   pages and the dark game panels of either scheme alike. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.wp-element-button:focus-visible,
.wp-block-navigation-item__content:focus-visible {
	outline: 3px solid var(--pulse-focus, var(--wp--preset--color--primary));
	outline-offset: 2px;
	box-shadow: 0 0 0 2px var(--pulse-focus-inner, var(--wp--preset--color--surface));
	border-radius: 4px;
}

:where(.gp-door, .gp-hero, .gp-subnav) {
	--pulse-focus: #FCD34D;
	--pulse-focus-inner: #000000;
}

.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface);
	border-radius: 8px;
	font-weight: 600;
	padding: 0.75rem 1.25rem;
	z-index: 100000;
}

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

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* 3. Components ---------------------------------------------------------- */

/* Header */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 50;
}

.pulse-header {
	background: var(--pulse-header-bg);
	-webkit-backdrop-filter: saturate(180%) blur(12px);
	backdrop-filter: saturate(180%) blur(12px);
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.admin-bar .wp-site-blocks > header.wp-block-template-part {
	top: var(--wp-admin--admin-bar--height, 32px);
}

.pulse-brand-mark {
	display: inline-grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	border-radius: 9px;
	background: var(--wp--preset--gradient--amber-night);
	color: #FFFFFF;
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 800;
	font-size: 0.95rem;
	letter-spacing: -0.04em;
	margin: 0;
}

.wp-block-navigation .wp-block-navigation-item__content {
	padding: 0.375rem 0.25rem;
}

.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content,
.wp-block-navigation .wp-block-navigation-item__content[aria-current="page"] {
	color: var(--wp--preset--color--primary-text);
}

.wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--surface) !important;
	color: var(--wp--preset--color--ink) !important;
}

/* Colour-scheme toggle */
.pulse-scheme-toggle {
	display: inline-grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 999px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	cursor: pointer;
	transition: background-color var(--wp--custom--transition, 180ms ease), border-color var(--wp--custom--transition, 180ms ease);
}

.pulse-scheme-toggle[hidden] {
	display: none;
}

.pulse-scheme-toggle:hover {
	border-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-text);
}

.pulse-scheme-toggle svg {
	width: 1.125rem;
	height: 1.125rem;
}

.pulse-scheme-toggle .pulse-icon-sun,
.pulse-scheme-toggle[aria-pressed="true"] .pulse-icon-moon {
	display: none;
}

.pulse-scheme-toggle[aria-pressed="true"] .pulse-icon-sun {
	display: block;
}

/* Eyebrow paragraphs */
.is-style-eyebrow {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary-text);
}

/* Check lists */
.wp-block-list.is-style-checks {
	list-style: none;
	padding-left: 0;
}

.wp-block-list.is-style-checks li {
	position: relative;
	padding-left: 1.75rem;
	margin-bottom: 0.5rem;
}

.wp-block-list.is-style-checks li::before {
	content: "";
	position: absolute;
	left: 0.3rem;
	top: 0.35em;
	width: 0.4rem;
	height: 0.8rem;
	border: solid var(--wp--preset--color--accent);
	border-width: 0 2.5px 2.5px 0;
	transform: rotate(45deg);
}

/* Cards */
.is-style-card {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--large, 22px);
	box-shadow: var(--wp--preset--shadow--card);
	padding: var(--wp--preset--spacing--40);
}

.pulse-post-card {
	height: 100%;
	transition: transform var(--wp--custom--transition, 180ms ease), box-shadow var(--wp--custom--transition, 180ms ease), border-color var(--wp--custom--transition, 180ms ease);
}

.pulse-post-card:hover,
.pulse-post-card:focus-within {
	transform: translateY(-3px);
	box-shadow: var(--wp--preset--shadow--lifted);
	border-color: color-mix(in srgb, var(--wp--preset--color--primary) 40%, var(--wp--preset--color--border));
}

.pulse-post-card .wp-block-post-featured-image {
	margin: calc(var(--wp--preset--spacing--40) * -1) calc(var(--wp--preset--spacing--40) * -1) 0;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--large, 22px) var(--wp--custom--radius--large, 22px) 0 0;
}

.pulse-post-card .wp-block-post-featured-image img {
	border-radius: 0;
	transition: transform 400ms cubic-bezier(0.2, 0, 0, 1);
}

.pulse-post-card:hover .wp-block-post-featured-image img {
	transform: scale(1.03);
}

.pulse-post-card .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.pulse-post-card {
	position: relative;
}

.pulse-post-card .wp-block-post-terms a {
	position: relative;
	z-index: 1;
}

/* Hero live card (wraps [gp_status]) */
.pulse-live-card {
	border-radius: var(--wp--custom--radius--large, 22px);
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	box-shadow: var(--wp--preset--shadow--lifted);
	padding: var(--wp--preset--spacing--40);
}

.pulse-live-card .gp-widget {
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
}

.pulse-live-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent-text);
}

.pulse-live-dot {
	width: 0.6rem;
	height: 0.6rem;
	border-radius: 999px;
	background: var(--wp--preset--color--accent);
	animation: pulse-live-ping 2s ease-out infinite;
}

@keyframes pulse-live-ping {
	0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.45); }
	100% { box-shadow: 0 0 0 0.6rem rgba(5, 150, 105, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.pulse-live-dot {
		animation: none;
	}
}

.pulse-brand-mark svg {
	width: 1.2rem;
	height: 1.2rem;
}

/* Hero headline accent */
.pulse-gradient-text {
	background: linear-gradient(120deg, var(--wp--preset--color--primary), var(--wp--preset--color--accent));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

/* Highlight details sidebar */
.pulse-detail-label {
	margin-bottom: 0.125rem !important;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.pulse-highlight-details > * + .pulse-detail-label {
	margin-top: 1.25rem;
}

.pulse-highlight-details p:not(.pulse-detail-label) {
	margin-top: 0;
}

@media (min-width: 782px) {
	.pulse-highlight-details {
		position: sticky;
		top: 6rem;
	}
}

/* Contact form */
.pulse-contact-form {
	display: grid;
	gap: 1.125rem;
}

.pulse-contact-form label {
	display: block;
	font-weight: 600;
	font-size: var(--wp--preset--font-size--small);
	margin-bottom: 0.375rem;
}

.pulse-contact-form input[type="text"],
.pulse-contact-form input[type="email"],
.pulse-contact-form textarea {
	width: 100%;
	box-sizing: border-box;
	font: inherit;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	padding: 0.75rem 0.875rem;
	transition: border-color var(--wp--custom--transition, 180ms ease), box-shadow var(--wp--custom--transition, 180ms ease);
}

.pulse-contact-form textarea {
	min-height: 10rem;
	resize: vertical;
}

.pulse-contact-form input:focus,
.pulse-contact-form textarea:focus {
	border-color: var(--wp--preset--color--primary);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--wp--preset--color--primary) 22%, transparent);
	outline: none;
}

.pulse-contact-form .pulse-hint {
	margin: 0.375rem 0 0;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--muted);
}

.pulse-contact-form .pulse-hp {
	position: absolute !important;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.pulse-contact-form button {
	justify-self: start;
	cursor: pointer;
}

.pulse-notice {
	border-radius: 12px;
	padding: 0.875rem 1rem;
	margin-bottom: 1.25rem;
	font-size: var(--wp--preset--font-size--small);
	border: 1px solid transparent;
}

.pulse-notice--success {
	background: var(--pulse-success-soft);
	border-color: color-mix(in srgb, var(--wp--preset--color--accent) 45%, transparent);
}

.pulse-notice--error {
	background: var(--pulse-danger-soft);
	border-color: color-mix(in srgb, var(--pulse-danger) 45%, transparent);
	color: var(--pulse-danger);
}

/* Footer */
.pulse-footer .wp-block-navigation {
	gap: 0.5rem;
}

.pulse-footer a {
	text-decoration: none;
}

.pulse-footer a:hover {
	text-decoration: underline;
}

/* Pagination */
.wp-block-query-pagination-numbers .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 2.25rem;
	height: 2.25rem;
	border-radius: 999px;
	text-decoration: none;
}

.wp-block-query-pagination-numbers .page-numbers.current {
	background: var(--wp--preset--color--primary-text);
	color: var(--wp--preset--color--on-primary);
}

/* Images inside article content */
.wp-block-post-content .wp-block-image img {
	border-radius: var(--wp--custom--radius--medium, 14px);
}

/* Outline buttons */
.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background) {
	background: transparent;
	border: 1px solid var(--wp--preset--color--border);
	padding: calc(0.75rem - 1px) calc(1.25rem - 1px);
}

.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-text-color) {
	color: var(--wp--preset--color--ink);
}

.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	border-color: currentColor;
	background: color-mix(in srgb, currentColor 8%, transparent);
}

.has-amber-night-gradient-background .wp-block-button.is-style-outline > .wp-block-button__link {
	border-color: rgba(255, 255, 255, 0.45);
}

/* 4. Reading aids (posts): progress bar, On this page, reading time, related posts ---- */

.pulse-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	z-index: 60;
	background: transparent;
	pointer-events: none;
}

.pulse-progress span {
	display: block;
	height: 100%;
	transform-origin: left;
	transform: scaleX(0);
	background: var(--wp--preset--color--primary);
	transition: transform 0.1s linear;
}

.pulse-reading-time {
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--muted);
}

.pulse-reading-time::before {
	content: "\00b7";
	margin-right: var(--wp--preset--spacing--20);
}

.pulse-toc {
	margin: var(--wp--preset--spacing--40) auto;
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 16px;
	background: var(--wp--preset--color--surface-alt);
	font-size: var(--wp--preset--font-size--small);
}

.pulse-toc-title {
	margin: 0 0 0.5rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--muted);
}

.pulse-toc ol {
	margin: 0;
	padding-left: 1.25rem;
}

.pulse-toc li + li {
	margin-top: 0.3rem;
}

.pulse-related {
	margin-top: var(--wp--preset--spacing--50);
	padding: var(--wp--preset--spacing--40);
	border-radius: 20px;
	background: var(--wp--preset--color--surface-alt);
	border: 1px solid var(--wp--preset--color--border);
}

.pulse-related h2 {
	margin: 0 0 var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--medium);
}

.pulse-related ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pulse-related li {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.5rem 0;
	border-top: 1px solid var(--wp--preset--color--border);
}

.pulse-related a {
	font-weight: 600;
	text-decoration: none;
}

.pulse-related a:hover,
.pulse-related a:focus-visible {
	text-decoration: underline;
}

.pulse-related-date {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--x-small);
}

@media (prefers-reduced-motion: reduce) {
	.pulse-progress span {
		transition: none;
	}
}
