/**
 * Apollo — base front-end design layer.
 *
 * Modern, minimalist defaults (Astra-like): generous whitespace, a clean type scale, subtle
 * borders instead of heavy shadows, and a restrained palette. Every value is driven by the
 * --apollo-* custom properties, so the Customizer (Appearance → Customize) restyles all of
 * this live without touching CSS.
 *
 * Works for both classic markup (.site-header/.site-footer) and block-theme markup
 * (header.wp-block-template-part, .wp-block-*).
 */

/* ------------------------------------------------------------------ *
 * 1. Reset & document
 * ------------------------------------------------------------------ */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: var(--apollo-font-body);
	font-size: var(--apollo-fs-md, 1rem);
	line-height: 1.65;
	color: var(--apollo-color-text);
	background: var(--apollo-color-surface);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

/* ------------------------------------------------------------------ *
 * 2. Typography
 * ------------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6 {
	font-family: var(--apollo-font-heading, var(--apollo-font-body));
	line-height: 1.2;
	font-weight: 700;
	margin: 0 0 .6em;
	color: var(--apollo-color-secondary, var(--apollo-color-text));
	letter-spacing: -0.01em;
}
h1 { font-size: var(--apollo-fs-xxl, 2.5rem); }
h2 { font-size: var(--apollo-fs-xl, 2rem); }
h3 { font-size: var(--apollo-fs-lg, 1.5rem); }
h4 { font-size: var(--apollo-fs-md, 1rem); }

p { margin: 0 0 1.2em; }

a {
	color: var(--apollo-color-primary);
	text-decoration: none;
	transition: color .15s ease;
}
a:hover { color: var(--apollo-color-accent); }

ul, ol { padding-left: 1.25em; }

blockquote {
	margin: 1.5em 0;
	padding: .25em 0 .25em 1.25em;
	border-left: 3px solid var(--apollo-color-primary);
	color: var(--apollo-color-secondary);
	font-size: var(--apollo-fs-lg, 1.25rem);
}

code, pre {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: .9em;
}
pre {
	background: #f6f7f9;
	padding: 1em 1.25em;
	border-radius: var(--apollo-radius, 6px);
	overflow: auto;
}

/* ------------------------------------------------------------------ *
 * 3. Layout / containers
 * ------------------------------------------------------------------ */
.wp-block-group.alignfull { padding-left: clamp(1rem, 4vw, 2.5rem); padding-right: clamp(1rem, 4vw, 2.5rem); }

main.wp-block-group,
.apollo-content {
	max-width: var(--apollo-wide-width, 1200px);
	margin-inline: auto;
	padding-inline: clamp(1rem, 4vw, 2rem);
}

/* ------------------------------------------------------------------ *
 * 4. Header (classic + block)
 * ------------------------------------------------------------------ */
.site-header,
header.wp-block-template-part,
.apollo-header {
	background-color: var(--apollo-color-surface);
	border-bottom: 1px solid color-mix(in srgb, var(--apollo-color-text) 8%, transparent);
	/* Manual header background position (Customize → Header → Background Position H/V) */
	background-position: var(--apollo-hdr-bgx, 50%) var(--apollo-hdr-bgy, 50%);
}

.site-header .wp-block-group,
header.wp-block-template-part .wp-block-group { align-items: center; }

/* Header row: brand left, menu right (robust even if block layout CSS is absent) */
.apollo-header__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: clamp(1rem, 3vw, 2rem);
	flex-wrap: wrap;
}
.apollo-header__brand {
	display: flex;
	align-items: center;
	gap: .75rem;
	flex-wrap: nowrap;
}
.apollo-header__brand .wp-block-site-logo,
.apollo-header__brand .wp-block-site-title { margin: 0; }

/* Header Layout presets (Customize → Header → Header Layout) */
body.apollo-hlayout-reversed .apollo-header__row { flex-direction: row-reverse; }
body.apollo-hlayout-centered .apollo-header__row {
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: .85rem;
}
body.apollo-hlayout-centered .apollo-header__brand { justify-content: center; }
body.apollo-hlayout-centered .wp-block-navigation { justify-content: center; }

.wp-block-site-title a,
.site-title a {
	font-weight: 700;
	font-size: var(--apollo-fs-lg, 1.35rem);
	color: var(--apollo-color-secondary);
	letter-spacing: -0.02em;
	text-decoration: none;
}

/* Navigation: space the items out horizontally even if core nav CSS doesn't load */
header.wp-block-template-part .wp-block-navigation .wp-block-navigation__container,
header.wp-block-template-part .wp-block-navigation ul,
.wp-block-navigation > .wp-block-page-list,
.wp-block-navigation__container.wp-block-page-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: clamp(1rem, 2vw, 1.6rem);
	margin: 0;
	padding: 0;
	list-style: none;
}
.wp-block-navigation li { margin: 0; }

/* Primary navigation */
.wp-block-navigation a,
.apollo-nav a {
	color: var(--apollo-color-secondary);
	font-weight: 500;
	font-size: .98rem;
	padding-block: .35em;
	position: relative;
}
.wp-block-navigation a:hover { color: var(--apollo-color-primary); }
.wp-block-navigation .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0; bottom: -2px;
	width: 0; height: 2px;
	background: var(--apollo-color-primary);
	transition: width .2s ease;
}
.wp-block-navigation .wp-block-navigation-item:hover .wp-block-navigation-item__content::after { width: 100%; }

/* ---- Mobile menu: hamburger + off-canvas overlay ---- */
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	color: var(--apollo-color-secondary, #1f2937);
	background: transparent;
	border: 0;
	cursor: pointer;
}
.wp-block-navigation__responsive-container-open svg,
.wp-block-navigation__responsive-container-close svg { fill: currentColor; width: 28px; height: 28px; }

/* The open overlay panel */
.wp-block-navigation__responsive-container.is-menu-open {
	background: var(--apollo-color-surface, #fff);
	padding: clamp(1.5rem, 6vw, 3rem);
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	color: var(--apollo-color-secondary, #1f2937);
	top: 1.25rem;
	right: 1.25rem;
}
/* Stack items vertically inside the overlay (override the desktop row) */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open ul {
	flex-direction: column;
	align-items: flex-start;
	gap: 1.25rem;
}
.wp-block-navigation__responsive-container.is-menu-open a {
	font-size: 1.2rem;
	color: var(--apollo-color-secondary, #1f2937);
}
.wp-block-navigation__responsive-container.is-menu-open a:hover { color: var(--apollo-color-primary, #5b34da); }

/* ------------------------------------------------------------------ *
 * 5. Buttons
 * ------------------------------------------------------------------ */
.wp-block-button__link,
.wp-element-button,
button,
input[type="submit"],
.apollo-btn {
	display: inline-block;
	background: var(--apollo-color-primary);
	color: #fff;
	font-weight: 600;
	font-size: .98rem;
	line-height: 1.2;
	padding: .7em 1.5em;
	border: 0 solid var(--apollo-color-border, transparent);
	border-radius: var(--apollo-radius, 6px);
	cursor: pointer;
	transition: transform .12s ease, filter .15s ease, background-color .15s ease;
}
.wp-block-button__link:hover,
.wp-element-button:hover,
button:hover,
input[type="submit"]:hover,
.apollo-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	color: var(--apollo-color-primary);
	box-shadow: inset 0 0 0 2px currentColor;
}

/* ------------------------------------------------------------------ *
 * 6. Forms
 * ------------------------------------------------------------------ */
input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
textarea,
select {
	width: 100%;
	font: inherit;
	color: inherit;
	padding: .6em .8em;
	background: #fff;
	border: 1px solid color-mix(in srgb, var(--apollo-color-text) 18%, transparent);
	border-radius: var(--apollo-radius, 6px);
	transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
	outline: none;
	border-color: var(--apollo-color-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--apollo-color-primary) 18%, transparent);
}

/* ------------------------------------------------------------------ *
 * 7. Blog / archive — clean minimalist cards
 * ------------------------------------------------------------------ */
.wp-block-query .wp-block-post-template {
	display: grid;
	gap: clamp(1.5rem, 4vw, 2.5rem);
}
.wp-block-query .wp-block-post-template.is-layout-grid { gap: 2rem; }

.wp-block-post {
	padding-bottom: 2rem;
	border-bottom: 1px solid color-mix(in srgb, var(--apollo-color-text) 8%, transparent);
}
.wp-block-post:last-child { border-bottom: 0; }

.wp-block-post-title { margin-bottom: .35em; font-size: var(--apollo-fs-lg, 1.5rem); }
.wp-block-post-title a { color: var(--apollo-color-secondary); }
.wp-block-post-title a:hover { color: var(--apollo-color-primary); }

.wp-block-post-excerpt__excerpt { color: color-mix(in srgb, var(--apollo-color-text) 78%, transparent); }

.wp-block-post-date,
.wp-block-post-author,
.apollo-post-meta {
	font-size: .85rem;
	color: color-mix(in srgb, var(--apollo-color-text) 60%, transparent);
}

.wp-block-post-featured-image img { border-radius: var(--apollo-radius, 6px); }

/* Pagination */
.wp-block-query-pagination { margin-top: 2.5rem; gap: .5rem; }
.wp-block-query-pagination a,
.wp-block-query-pagination span {
	padding: .4em .8em;
	border-radius: var(--apollo-radius, 6px);
	color: var(--apollo-color-secondary);
}
.wp-block-query-pagination .current { background: var(--apollo-color-primary); color: #fff; }

/* ------------------------------------------------------------------ *
 * 8. Footer
 * ------------------------------------------------------------------ */
.site-footer,
footer.wp-block-template-part,
.apollo-footer {
	background: var(--apollo-color-secondary, #1f2937);
	color: #e5e7eb;
	margin-top: clamp(3rem, 8vw, 6rem);
}
.site-footer a,
footer.wp-block-template-part a,
.apollo-footer a { color: #fff; opacity: .85; }
.site-footer a:hover,
footer.wp-block-template-part a:hover,
.apollo-footer a:hover { opacity: 1; }

.apollo-footer-widgets {
	display: grid;
	gap: var(--apollo-space-8, 32px);
	grid-template-columns: repeat(var(--apollo-footer-cols, 3), minmax(0, 1fr));
	max-width: var(--apollo-wide-width, 1200px);
	margin-inline: auto;
	padding: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem);
}
.apollo-footer-widget__title { font-size: 1rem; color: #fff; margin-bottom: .75em; }

/* ------------------------------------------------------------------ *
 * 9. Utilities & accessibility
 * ------------------------------------------------------------------ */
:where(a, button, input, select, textarea):focus-visible {
	outline: 2px solid var(--apollo-color-primary);
	outline-offset: 2px;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--apollo-color-primary);
	color: #fff;
	padding: .75em 1.25em;
	z-index: 1000;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* Transparent header — overlays the first section (Header → Transparent Header) */
body.apollo-header-transparent .wp-site-blocks > header,
body.apollo-header-transparent header.wp-block-template-part,
body.apollo-header-transparent .apollo-header {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	z-index: 20;
	background: transparent;
	border-bottom: 0;
}

/* Sticky header gets a soft shadow when enabled via the Customizer */
.apollo-header[style*="sticky"],
header.wp-block-template-part[style*="sticky"] {
	backdrop-filter: saturate(180%) blur(8px);
	box-shadow: 0 1px 0 color-mix(in srgb, var(--apollo-color-text) 10%, transparent);
}

/* ------------------------------------------------------------------ *
 * 9b. Site layout modes (General → Site Layout)
 * ------------------------------------------------------------------ */
body.apollo-layout-boxed {
	background: var(--apollo-boxed-bg, #eef0f4);
}
body.apollo-layout-boxed .wp-site-blocks,
body.apollo-layout-boxed > .wp-block-template-part,
body.apollo-layout-boxed main.wp-block-group {
	max-width: var(--apollo-wide-width, 1200px);
	margin-inline: auto;
}
body.apollo-layout-boxed .wp-site-blocks {
	background: var(--apollo-color-surface, #fff);
	box-shadow: 0 0 40px rgba(0, 0, 0, .06);
}
body.apollo-layout-content-boxed main.wp-block-group {
	background: var(--apollo-color-surface, #fff);
	box-shadow: 0 0 30px rgba(0, 0, 0, .05);
	border-radius: var(--apollo-radius, 6px);
	padding: clamp(1.5rem, 4vw, 3rem);
}

/* Sidebar layouts (where a template exposes .apollo-content + .apollo-sidebar) */
body.apollo-sidebar-right .apollo-has-sidebar,
body.apollo-sidebar-left .apollo-has-sidebar {
	display: grid;
	gap: clamp(1.5rem, 4vw, 3rem);
	grid-template-columns: minmax(0, 1fr) 300px;
}
body.apollo-sidebar-left .apollo-has-sidebar { grid-template-columns: 300px minmax(0, 1fr); }
body.apollo-sidebar-left .apollo-sidebar { order: -1; }

/* ------------------------------------------------------------------ *
 * 9c. Scroll-to-top button (General → Scroll To Top)
 * ------------------------------------------------------------------ */
.apollo-scrolltop {
	position: fixed;
	bottom: 1.5rem;
	width: 2.75rem;
	height: 2.75rem;
	display: grid;
	place-items: center;
	font-size: 1.25rem;
	color: #fff;
	background: var(--apollo-color-primary);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
	cursor: pointer;
	z-index: 999;
	transition: transform .15s ease, filter .15s ease;
}
.apollo-scrolltop--right { right: 1.5rem; }
.apollo-scrolltop--left { left: 1.5rem; }
.apollo-scrolltop:hover { filter: brightness(1.1); transform: translateY(-2px); }
.apollo-scrolltop[hidden] { display: none; }

/* ------------------------------------------------------------------ *
 * 9d. Sidebar / widgets (General → Sidebar)
 * ------------------------------------------------------------------ */
.apollo-sidebar {
	background: #f8f9fb;
	padding: 24px;
	border-radius: var(--apollo-radius, 6px);
}
.apollo-sidebar .widget { margin-bottom: 1.75rem; }
.apollo-sidebar .widget:last-child { margin-bottom: 0; }
.apollo-sidebar .widget-title,
.apollo-sidebar .widget h2 {
	font-size: 1.1rem;
	margin-bottom: .75em;
	font-family: var(--apollo-font-heading, var(--apollo-font-body));
}
.apollo-sidebar ul { list-style: none; padding-left: 0; margin: 0; }
.apollo-sidebar li { padding: .35em 0; border-bottom: 1px solid var(--apollo-color-border, #e5e7eb); }

/* ------------------------------------------------------------------ *
 * 9e. Dark mode (Header → Dark Mode / Color Switcher)
 * ------------------------------------------------------------------ */
html.apollo-dark {
	--apollo-color-surface: var(--apollo-dark-bg, #0f1115);
	--apollo-content-bg: var(--apollo-dark-surface, #161922);
	--apollo-color-text: var(--apollo-dark-text, #d1d5db);
	--apollo-color-border: #2b2f3a;
	color-scheme: dark;
}
html.apollo-dark h1, html.apollo-dark h2, html.apollo-dark h3,
html.apollo-dark h4, html.apollo-dark h5, html.apollo-dark h6 { color: var(--apollo-dark-heading, #f9fafb); }
html.apollo-dark .site-header,
html.apollo-dark header.wp-block-template-part,
html.apollo-dark .apollo-header { background: var(--apollo-content-bg); }
html.apollo-dark .apollo-sidebar { background: var(--apollo-content-bg); }
html.apollo-dark pre { background: #1f2430; }

/* Dark-mode toggle button */
.apollo-darktoggle {
	position: fixed;
	bottom: 1.5rem;
	width: 2.75rem;
	height: 2.75rem;
	display: grid;
	place-items: center;
	font-size: 1.2rem;
	color: #fff;
	background: var(--apollo-color-secondary, #1f2937);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
	cursor: pointer;
	z-index: 998;
}
.apollo-darktoggle--right { right: 1.5rem; }
.apollo-darktoggle--left { left: 1.5rem; }
/* When both scroll-top and dark-toggle share a side, stack them */
.apollo-darktoggle--right { bottom: 4.75rem; }
.apollo-darktoggle--left { bottom: 4.75rem; }
.apollo-darktoggle__moon { display: none; }
html.apollo-dark .apollo-darktoggle__sun { display: none; }
html.apollo-dark .apollo-darktoggle__moon { display: inline; }

/* ------------------------------------------------------------------ *
 * 10. Responsive
 * ------------------------------------------------------------------ */
@media (max-width: 782px) {
	h1 { font-size: clamp(2rem, 8vw, 2.5rem); }
	.apollo-footer-widgets { grid-template-columns: 1fr; gap: 2rem; }
	.wp-block-query .wp-block-post-template.is-layout-grid { grid-template-columns: 1fr !important; }
	/* Auto-minimalist: core Columns stack full-width on mobile (even if "stack on mobile" is off). */
	.wp-block-columns { flex-wrap: wrap !important; }
	.wp-block-columns > .wp-block-column { flex-basis: 100% !important; }
}
