/*
Theme Name: FoA Cleaner
Theme URI: https://cleaner.diuldia.com
Author: Ivan Diuldia
Author URI: https://ivan.diuldia.com
Description: A universal, minimalistic WordPress block theme built on Clean Design principles: generous whitespace, self-hosted Geist and DM Sans typography, signature FoA Blue accents, built-in light and dark modes, editorial reading polish, and seamless optional Vibetiles compatibility.
Version: 1.0.0
Requires at least: 6.6
Tested up to: 6.8
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: foa-cleaner
Tags: block-patterns, block-styles, custom-colors, custom-logo, custom-menu, editor-style, featured-images, full-site-editing, one-column, blog, portfolio, style-variations, template-editing, threaded-comments, translation-ready, wide-blocks
GitHub Theme URI: https://github.com/ivans3m/foa-cleaner
Primary Branch: main
*/

/* --------------------------------------------------------------------------
 * 1. Semantic Design Tokens (mapped to theme.json presets for Vibetiles &
 *    Global Style Variation harmony)
 * -------------------------------------------------------------------------- */

:root {
	--foa-bg: var(--wp--preset--color--base, #FFFFFF);
	--foa-surface: var(--wp--preset--color--surface, #F7F6F2);
	--foa-surface-elevated: #0F0E0C;
	--foa-text: var(--wp--preset--color--contrast, #0F0E0C);
	--foa-text-secondary: var(--wp--preset--color--contrast-secondary, #6B6760);
	--foa-text-muted: var(--wp--preset--color--contrast-muted, #A8A49F);
	--foa-text-invert: var(--wp--preset--color--surface-dark-text, #F6F4EE);
	--foa-border: var(--wp--preset--color--border, #E8E6E1);
	--foa-border-strong: var(--wp--preset--color--border-strong, #D7D4CD);
	--foa-accent: var(--wp--preset--color--foa-blue, #2E70FF);
	--foa-accent-hover: var(--wp--preset--color--foa-blue-hover, #1D5CE6);
	--foa-accent-solid: var(--wp--preset--color--foa-blue, #2E70FF);
	--foa-accent-solid-hover: var(--wp--preset--color--foa-blue-hover, #1D5CE6);
	--foa-accent-text: #FFFFFF;
	--foa-btn-primary-hover: color-mix(in srgb, var(--foa-text) 85%, var(--foa-bg));
	--foa-focus-ring: color-mix(in srgb, var(--foa-accent) 45%, transparent);
	--foa-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
	--foa-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.08);
	--foa-shadow-elevated: 0 8px 30px rgba(0, 0, 0, 0.09);
	--foa-header-bg: color-mix(in srgb, var(--foa-bg) 92%, transparent);
	--foa-radius-control: var(--wp--custom--radius--control, 8px);
	--foa-radius-card: var(--wp--custom--radius--card, 12px);
	--foa-radius-pill: var(--wp--custom--radius--pill, 9999px);
	--foa-transition: 0.18s ease;
	color-scheme: light;
}

/* --------------------------------------------------------------------------
 * 2. Standalone Dark Mode & Dark-First Style Variations
 *    Gated so Vibetiles owns color-scheme switching whenever it is active.
 * -------------------------------------------------------------------------- */

/* Light-first variations toggled to Dark Mode */
:root[data-foa-theme="dark"]:not([data-foa-variation-scheme="dark"]):not([data-theme]):not([data-chosen]):not([data-colours]) {
	--wp--preset--color--base: #0F0E0C;
	--wp--preset--color--surface: #171613;
	--wp--preset--color--contrast: #F6F4EE;
	--wp--preset--color--contrast-secondary: #A8A49F;
	--wp--preset--color--contrast-muted: #8A857E;
	--wp--preset--color--border: #262420;
	--wp--preset--color--border-strong: #38352F;
	--wp--preset--color--surface-dark-text: #F6F4EE;
	--wp--preset--color--foa-blue: #5C91FF;
	--wp--preset--color--foa-blue-hover: #82ACFF;
	--foa-surface-elevated: #1C1B18;
	--foa-accent-solid: #2E70FF;
	--foa-accent-solid-hover: #1D5CE6;
	--foa-btn-primary-hover: #FFFFFF;
	--foa-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.24);
	--foa-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.42);
	--foa-shadow-elevated: 0 12px 34px rgba(0, 0, 0, 0.52);
	color-scheme: dark;
}

/* Dark-first variations (e.g. Midnight Slate) in their native dark mode */
:root[data-foa-variation-scheme="dark"]:not([data-foa-theme="light"]):not([data-theme]):not([data-chosen]):not([data-colours]) {
	--foa-surface-elevated: color-mix(in srgb, var(--foa-surface) 92%, #FFFFFF);
	--foa-accent-solid: color-mix(in srgb, var(--foa-accent) 82%, #000000);
	--foa-accent-solid-hover: color-mix(in srgb, var(--foa-accent) 68%, #000000);
	--foa-btn-primary-hover: #FFFFFF;
	--foa-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
	--foa-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.45);
	--foa-shadow-elevated: 0 12px 34px rgba(0, 0, 0, 0.55);
	color-scheme: dark;
}

/* Dark-first variations toggled to Light Mode by visitor */
:root[data-foa-variation-scheme="dark"][data-foa-theme="light"]:not([data-theme]):not([data-chosen]):not([data-colours]) {
	--wp--preset--color--base: #FFFFFF;
	--wp--preset--color--surface: #F4F6FA;
	--wp--preset--color--contrast: #0B0D11;
	--wp--preset--color--contrast-secondary: #525B6B;
	--wp--preset--color--contrast-muted: #7B8394;
	--wp--preset--color--border: #E2E6EF;
	--wp--preset--color--border-strong: #C9D0DF;
	--wp--preset--color--surface-dark-text: #F4F6FA;
	--wp--preset--color--foa-blue: #2E70FF;
	--wp--preset--color--foa-blue-hover: #1D5CE6;
	--foa-surface-elevated: #0B0D11;
	color-scheme: light;
}

/* Elevated dark surface treatment for dark sections whenever dark mode or a dark-first variation is active */
:root:is([data-foa-theme="dark"], [data-foa-variation-scheme="dark"]:not([data-foa-theme="light"])):not([data-theme]):not([data-chosen]):not([data-colours]) :is(.has-contrast-background-color, .is-style-dark-band) {
	background-color: var(--foa-surface-elevated) !important;
	color: var(--foa-text-invert);
	border-color: var(--foa-border);
}

:root:is([data-foa-theme="dark"], [data-foa-variation-scheme="dark"]:not([data-foa-theme="light"])):not([data-theme]):not([data-chosen]):not([data-colours]) :is(.has-contrast-background-color, .is-style-dark-band) :is(h1, h2, h3, h4, h5, h6) {
	color: var(--foa-text-invert);
}

:root:is([data-foa-theme="dark"], [data-foa-variation-scheme="dark"]:not([data-foa-theme="light"])):not([data-theme]):not([data-chosen]):not([data-colours]) :is(.has-contrast-background-color, .is-style-dark-band) .wp-block-button:not(.is-style-accent):not(.is-style-ghost):not(.is-style-outline) .wp-block-button__link:hover {
	background-color: var(--foa-btn-primary-hover);
	color: #0F0E0C;
}

/* --------------------------------------------------------------------------
 * 3. Base Reset & Typography Polish
 * -------------------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

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

body {
	margin: 0;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

a {
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
	transition: color var(--foa-transition), opacity var(--foa-transition);
}

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--foa-accent);
	outline-offset: 2px;
	box-shadow: 0 0 0 4px var(--foa-focus-ring);
}

/* Skip link */
.skip-link.screen-reader-text:focus {
	position: fixed;
	top: 1rem;
	left: 1rem;
	z-index: 100000;
	padding: 0.75rem 1.25rem;
	background-color: var(--foa-text);
	color: var(--foa-bg);
	border-radius: var(--foa-radius-control);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 500;
	text-decoration: none;
	box-shadow: var(--foa-shadow-elevated);
}

/* Inline code */
:not(pre) > code {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.875em;
	padding: 0.15em 0.4em;
	border-radius: 5px;
	background-color: var(--foa-surface);
	border: 1px solid var(--foa-border);
	color: var(--foa-text);
}

/* Form inputs */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
textarea,
select {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--sm);
	color: var(--foa-text);
	background-color: var(--foa-bg);
	border: 1px solid var(--foa-border);
	border-radius: var(--foa-radius-control);
	padding: 0.6875rem 0.875rem;
	line-height: 1.5;
	transition: border-color var(--foa-transition), box-shadow var(--foa-transition);
}

input:hover:not(:focus),
textarea:hover:not(:focus),
select:hover:not(:focus) {
	border-color: var(--foa-border-strong);
}

input::placeholder,
textarea::placeholder {
	color: var(--foa-text-muted);
}

/* Inline Lucide SVG icons */
.foa-icon {
	display: inline-block;
	width: 1.125em;
	height: 1.125em;
	flex-shrink: 0;
	vertical-align: -0.15em;
}

/* --------------------------------------------------------------------------
 * 4. Standalone Theme Mode Toggle Button
 * -------------------------------------------------------------------------- */

.foa-theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 1px solid var(--foa-border);
	border-radius: var(--foa-radius-control);
	background-color: transparent;
	color: var(--foa-text-secondary);
	cursor: pointer;
	transition: background-color var(--foa-transition), color var(--foa-transition), border-color var(--foa-transition), transform var(--foa-transition);
}

.foa-theme-toggle:hover {
	background-color: var(--foa-surface);
	border-color: var(--foa-border-strong);
	color: var(--foa-text);
}

.foa-theme-toggle:active {
	transform: scale(0.96);
}

.foa-theme-toggle .foa-icon {
	width: 1.0625rem;
	height: 1.0625rem;
}

.foa-theme-toggle .foa-icon-sun {
	display: none;
}

.foa-theme-toggle .foa-icon-moon {
	display: inline-block;
}

:root[data-foa-theme="dark"] .foa-theme-toggle .foa-icon-sun {
	display: inline-block;
}

:root[data-foa-theme="dark"] .foa-theme-toggle .foa-icon-moon {
	display: none;
}

/* Hide standalone toggle whenever Vibetiles is active on the page */
body.foa-vibetiles-active .foa-theme-toggle,
:root[data-theme] .foa-theme-toggle {
	display: none !important;
}

/* --------------------------------------------------------------------------
 * 5. Buttons & Core Block Styles
 * -------------------------------------------------------------------------- */

.wp-block-button__link,
.wp-element-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	cursor: pointer;
	transition: background-color var(--foa-transition), color var(--foa-transition), border-color var(--foa-transition), transform var(--foa-transition), box-shadow var(--foa-transition);
}

.wp-block-button__link:active,
.wp-element-button:active {
	transform: scale(0.98);
}

/* Button Style: FoA Blue Accent */
.wp-block-button.is-style-accent .wp-block-button__link {
	background-color: var(--foa-accent-solid);
	color: var(--foa-accent-text);
	border: 1px solid transparent;
}

.wp-block-button.is-style-accent .wp-block-button__link:hover {
	background-color: var(--foa-accent-solid-hover);
	color: var(--foa-accent-text);
}

/* Button Style: Ghost */
.wp-block-button.is-style-ghost .wp-block-button__link {
	background-color: transparent;
	color: var(--foa-text);
	border: 1px solid var(--foa-border-strong);
}

.wp-block-button.is-style-ghost .wp-block-button__link:hover {
	background-color: var(--foa-surface);
	border-color: var(--foa-border-strong);
	color: var(--foa-text);
}

/* Button Style: Light (for inverted dark sections) */
.wp-block-button.is-style-light .wp-block-button__link {
	background-color: var(--foa-text-invert);
	color: #0F0E0C;
	border: 1px solid var(--foa-text-invert);
}

.wp-block-button.is-style-light .wp-block-button__link:hover {
	background-color: #FFFFFF;
	border-color: #FFFFFF;
	color: #0F0E0C;
}

/* Dark Band button defaults so primary buttons remain high contrast on dark surfaces */
:is(.has-contrast-background-color, .is-style-dark-band) .wp-block-button:not(.is-style-accent):not(.is-style-ghost):not(.is-style-outline) .wp-block-button__link {
	background-color: var(--foa-text-invert);
	color: #0F0E0C;
}

:is(.has-contrast-background-color, .is-style-dark-band) .wp-block-button:not(.is-style-accent):not(.is-style-ghost):not(.is-style-outline) .wp-block-button__link:hover {
	background-color: #FFFFFF;
	color: #0F0E0C;
}

:is(.has-contrast-background-color, .is-style-dark-band) .wp-block-button.is-style-ghost .wp-block-button__link {
	color: var(--foa-text-invert);
	border-color: rgba(246, 244, 238, 0.25);
}

:is(.has-contrast-background-color, .is-style-dark-band) .wp-block-button.is-style-ghost .wp-block-button__link:hover {
	background-color: rgba(246, 244, 238, 0.08);
	border-color: rgba(246, 244, 238, 0.4);
	color: #FFFFFF;
}

/* Paragraph Style: Overline */
.is-style-overline {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--foa-text-muted);
	line-height: 1.4;
}

/* Paragraph Style: Pill Badge */
.is-style-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.25rem 0.75rem;
	border-radius: var(--foa-radius-pill);
	border: 1px solid var(--foa-border);
	background-color: var(--foa-surface);
	color: var(--foa-text-secondary);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 500;
	line-height: 1.4;
	width: fit-content;
}

/* Paragraph Style: Lead Text */
.is-style-lead {
	font-size: var(--wp--preset--font-size--lg);
	line-height: 1.55;
	color: var(--foa-text-secondary);
}

/* Group Style: Clean Card */
.wp-block-group.is-style-card {
	background-color: var(--foa-bg);
	border: 1px solid var(--foa-border);
	border-radius: var(--foa-radius-card);
	padding: var(--wp--preset--spacing--lg);
	box-shadow: var(--foa-shadow-card);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.wp-block-group.is-style-card:hover {
	border-color: var(--foa-border-strong);
}

/* Group Style: Elevated Card */
.wp-block-group.is-style-card-elevated {
	background-color: var(--foa-bg);
	border: 1px solid var(--foa-border-strong);
	border-radius: var(--foa-radius-card);
	padding: var(--wp--preset--spacing--lg);
	box-shadow: var(--foa-shadow-elevated);
}

/* Group Style: Dark Band */
.wp-block-group.is-style-dark-band {
	background-color: #0F0E0C;
	color: var(--foa-text-invert);
	border-top: 1px solid var(--foa-border);
	border-bottom: 1px solid var(--foa-border);
}

.wp-block-group.is-style-dark-band :is(h1, h2, h3, h4, h5, h6) {
	color: var(--foa-text-invert);
}

.wp-block-group.is-style-dark-band .is-style-overline {
	color: #A8A49F;
}

/* Group Style: Hairline Top */
.wp-block-group.is-style-hairline-top {
	border-top: 1px solid var(--foa-border);
	padding-top: var(--wp--preset--spacing--xl);
}

/* Columns Style: Hairline Grid */
.wp-block-columns.is-style-hairline-grid {
	gap: 0;
	border-top: 1px solid var(--foa-border);
	border-bottom: 1px solid var(--foa-border);
}

.wp-block-columns.is-style-hairline-grid > .wp-block-column {
	padding: var(--wp--preset--spacing--md);
	border-right: 1px solid var(--foa-border);
}

.wp-block-columns.is-style-hairline-grid > .wp-block-column:last-child {
	border-right: none;
}

@media (max-width: 781px) {
	.wp-block-columns.is-style-hairline-grid > .wp-block-column {
		border-right: none;
		border-bottom: 1px solid var(--foa-border);
	}

	.wp-block-columns.is-style-hairline-grid > .wp-block-column:last-child {
		border-bottom: none;
	}
}

/* List Style: Checklist */
ul.is-style-checklist {
	list-style: none;
	padding-left: 0;
}

ul.is-style-checklist li {
	position: relative;
	padding-left: 1.625rem;
	margin-bottom: 0.5rem;
	color: var(--foa-text-secondary);
}

ul.is-style-checklist li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.38em;
	width: 0.95rem;
	height: 0.95rem;
	background-color: var(--foa-accent);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Details Style: Clean Accordion */
.wp-block-details.is-style-clean-accordion {
	border-bottom: 1px solid var(--foa-border);
	padding: 1.25rem 0;
}

.wp-block-details.is-style-clean-accordion summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	list-style: none;
	cursor: pointer;
	font-family: var(--wp--preset--font-family--display);
	font-weight: 500;
	font-size: var(--wp--preset--font-size--lg);
	color: var(--foa-text);
}

.wp-block-details.is-style-clean-accordion summary::-webkit-details-marker {
	display: none;
}

.wp-block-details.is-style-clean-accordion summary::after {
	content: "";
	width: 1.125rem;
	height: 1.125rem;
	flex-shrink: 0;
	background-color: var(--foa-text-muted);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14'/%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14'/%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E") no-repeat center / contain;
	transition: transform 0.25s ease, background-color var(--foa-transition);
}

.wp-block-details.is-style-clean-accordion[open] summary::after {
	transform: rotate(45deg);
	background-color: var(--foa-text);
}

/* Table Style: Comparison */
.wp-block-table.is-style-comparison table {
	width: 100%;
	border-collapse: collapse;
	border-top: 1px solid var(--foa-border);
}

.wp-block-table.is-style-comparison th,
.wp-block-table.is-style-comparison td {
	padding: 1rem 1.25rem;
	border: none;
	border-bottom: 1px solid var(--foa-border);
	text-align: left;
	vertical-align: top;
}

.wp-block-table.is-style-comparison thead th {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--foa-text-muted);
}

/* --------------------------------------------------------------------------
 * 6. Accessibility Preferences
 * -------------------------------------------------------------------------- */

@media (prefers-contrast: more) {
	:root {
		--foa-border: var(--foa-border-strong);
		--foa-accent: var(--foa-accent-hover);
		--foa-accent-solid: var(--foa-accent-solid-hover);
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

:root[data-foa-motion="off"] *,
:root[data-foa-motion="off"] *::before,
:root[data-foa-motion="off"] *::after {
	animation-duration: 0.01ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.01ms !important;
}
