/*
Theme Name: The Facilitators' Guild
Theme URI: https://facilitatorsguild.com/
Author: The Facilitators' Guild
Description: A lightweight, independent block theme for The Facilitators' Guild. Design tokens live in theme.json; this file holds only the few rules theme.json cannot express (focus states, decorative motifs, header behaviour, reduced motion).
Version: 1.4.2
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: facilitators-guild
Update URI: false
Tags: block-theme, full-site-editing, one-column, wide-blocks
*/

/* ------------------------------------------------------------------
 * 1. Links: underline treatment (hover changes thickness, not just colour)
 * ------------------------------------------------------------------ */
a {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

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

/* ------------------------------------------------------------------
 * 2. Focus states (WCAG 2.2: visible, high-contrast, never removed)
 * ------------------------------------------------------------------ */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.wp-block-button__link:focus-visible,
.wp-block-navigation-item__content:focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--primary);
	outline-offset: var(--wp--custom--focus--offset);
	border-radius: 2px;
}

/* On Guild Blue surfaces the ring switches to Soft Sand (9.2:1). */
[class*="is-style-section-blue"] :focus-visible,
[class*="is-style-section-blue"] .wp-block-button__link:focus-visible {
	outline-color: var(--wp--preset--color--base-alt);
}

/* Skip link (provided by WordPress core) */
.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary);
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--primary);
	outline-offset: 0;
	font-family: var(--wp--preset--font-family--sans);
	font-weight: 600;
}

/* ------------------------------------------------------------------
 * 3. Header
 * ------------------------------------------------------------------ */
.fg-header {
	border-bottom: 1px solid var(--wp--preset--color--base-alt);
}

.fg-header .wp-block-site-logo img {
	height: auto;
}

/* Mobile logo cap. Adjust with one line of Additional CSS, e.g.
   :root { --wp--custom--logo--header-mobile-max-width: 110px; } */
@media (max-width: 599px) {
	.fg-header .wp-block-site-logo img {
		max-width: var(--wp--custom--logo--header-mobile-max-width, 100px);
	}
}

/* Primary navigation: comfortable touch targets, clear current-page marker. */
.fg-primary-nav .wp-block-navigation-item__content {
	padding: 0.5rem 0.25rem;
	text-decoration: none;
}

.fg-primary-nav .wp-block-navigation-item__content:hover {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.35em;
}

.fg-primary-nav .wp-block-navigation-item__content[aria-current="page"] {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 3px;
	text-underline-offset: 0.35em;
}

/* Overlay (mobile) menu: left-aligned, larger, well-spaced items. */
.fg-primary-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.fg-primary-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	align-items: flex-start;
	justify-content: flex-start;
}

.fg-primary-nav .wp-block-navigation__responsive-container.is-menu-open {
	padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.fg-primary-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--large);
	padding: 0.5rem 0;
}

.fg-primary-nav .wp-block-navigation__responsive-container-open,
.fg-primary-nav .wp-block-navigation__responsive-container-close {
	min-width: 44px;
	min-height: 44px;
	justify-content: center;
	align-items: center;
}

/* Tablets and landscape phones (600-899px): smaller logo and menu text so
   the header stays compact. 700px and up: logo beside the menu.
   600-699px: logo centred above a single-row menu. */
@media (min-width: 600px) and (max-width: 899px) {
	.fg-header .wp-block-site-logo img {
		max-width: var(--wp--custom--logo--header-tablet-max-width, 112px);
	}

	.fg-primary-nav {
		font-size: 1rem;
	}

	.fg-primary-nav .wp-block-navigation__container {
		column-gap: 1rem;
	}
}

@media (min-width: 600px) and (max-width: 699px) {
	.fg-header__inner {
		flex-wrap: wrap !important;
		justify-content: center !important;
		row-gap: var(--wp--preset--spacing--20);
	}

	.fg-header .wp-block-site-logo img {
		max-width: 88px;
	}

	.fg-header__inner .wp-block-navigation {
		flex-basis: 100%;
	}

	.fg-header__inner .wp-block-navigation__container {
		justify-content: center;
		column-gap: 0.75rem;
	}
}

/* Short landscape screens: tighten header padding. */
@media (max-height: 500px) and (orientation: landscape) {
	.fg-header {
		padding-top: 0.5rem !important;
		padding-bottom: 0.5rem !important;
	}
}

/* ------------------------------------------------------------------
 * 4. Footer
 * ------------------------------------------------------------------ */
.wp-site-blocks > footer {
	margin-block-start: 0;
}

.fg-footer .wp-block-navigation {
	font-weight: 400;
}

.fg-footer .wp-block-navigation-item__content {
	padding: 0.25rem 0;
}

/* Stand-alone footer links (e.g. Privacy Policy) get a 24px+ target. */
.fg-footer p > a:only-child,
.fg-privacy-link a {
	display: inline-block;
	padding-block: 0.25rem;
}

.fg-footer .wp-block-navigation-item__content[aria-current="page"] {
	text-decoration: underline;
}

/* ------------------------------------------------------------------
 * 5. Eyebrow label with Bronze accent rule (block style)
 * ------------------------------------------------------------------ */
.is-style-fg-eyebrow {
	color: var(--wp--preset--color--accent-text);
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.is-style-fg-eyebrow::before {
	content: "";
	display: block;
	width: 2.5rem;
	height: 2px;
	margin-bottom: 0.75rem;
	background: var(--wp--preset--color--accent);
}

.has-text-align-center.is-style-fg-eyebrow::before {
	margin-inline: auto;
}

/* Inside cards the label stands alone; the rule is kept for section openings. */
[class*="is-style-card"] .is-style-fg-eyebrow::before {
	display: none;
}

[class*="is-style-section-blue"] .is-style-fg-eyebrow {
	color: var(--wp--preset--color--base-alt);
}

/* ------------------------------------------------------------------
 * 6. Separators: default hairline and the optional four-node divider
 * ------------------------------------------------------------------ */
.wp-block-separator {
	border: 0;
	border-top: 1px solid currentColor;
	opacity: 1;
}

.wp-block-separator.is-style-fg-nodes {
	border: 0;
	width: 7.5rem;
	max-width: 100%;
	height: 12px;
	margin-inline: auto;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M6 6h108' stroke='%23000' stroke-width='1'/%3E%3Ccircle cx='6' cy='6' r='4'/%3E%3Ccircle cx='42' cy='6' r='4'/%3E%3Ccircle cx='78' cy='6' r='4'/%3E%3Ccircle cx='114' cy='6' r='4'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M6 6h108' stroke='%23000' stroke-width='1'/%3E%3Ccircle cx='6' cy='6' r='4'/%3E%3Ccircle cx='42' cy='6' r='4'/%3E%3Ccircle cx='78' cy='6' r='4'/%3E%3Ccircle cx='114' cy='6' r='4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ------------------------------------------------------------------
 * 7. Buttons: secondary (outline) hover; outline on Guild Blue
 * ------------------------------------------------------------------ */
.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--base-alt);
	border-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary);
}

[class*="is-style-section-blue"] .wp-block-button.is-style-outline > .wp-block-button__link {
	background-color: transparent;
	border-color: var(--wp--preset--color--base-alt);
	color: var(--wp--preset--color--base);
}

[class*="is-style-section-blue"] .wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary);
}

.wp-block-button__link {
	min-height: 44px;
}

/* ------------------------------------------------------------------
 * 8. Cards: titles carry the link; whole card stays simple and readable
 * ------------------------------------------------------------------ */
[class*="is-style-card"] > :first-child {
	margin-top: 0;
}

[class*="is-style-card"] :where(h2, h3) a {
	text-decoration: none;
}

[class*="is-style-card"] :where(h2, h3) a:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------------
 * 9. Motion: brief colour transitions only, removed on request
 * ------------------------------------------------------------------ */
a,
.wp-block-button__link {
	transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

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

/* Balanced line breaks for headings (progressive enhancement). */
:where(h1, h2, h3) {
	text-wrap: balance;
}

/* 404: live list of published pages. */
.fg-page-list {
	padding-left: 1.25em;
}

.fg-page-list li {
	margin-block: 0.35rem;
}

/* ------------------------------------------------------------------
 * 10. Page content helpers (Build 3)
 * ------------------------------------------------------------------ */

/* Photo slots: editing notes marking where an approved photo will go.
   Visible only in the editor; never shown to visitors. */
.fg-photo-slot {
	display: none;
}

.editor-styles-wrapper .fg-photo-slot {
	display: block;
	padding: var(--wp--preset--spacing--30);
	border: 2px dashed var(--wp--preset--color--accent);
	border-radius: var(--wp--custom--radius--medium);
	color: var(--wp--preset--color--accent-text);
	font-size: var(--wp--preset--font-size--small);
}

/* Diagrams: a light panel so they read on any section colour. */
.fg-diagram-panel img {
	display: block;
	margin-inline: auto;
}

/* Tables: quiet Bronze rules, comfortable cells, scroll on narrow screens. */
.wp-block-table {
	overflow-x: auto;
}

.wp-block-table :where(th, td) {
	border: 1px solid var(--wp--preset--color--accent);
	padding: 0.6rem 0.8rem;
	vertical-align: top;
	text-align: left;
}

.wp-block-table th {
	background: var(--wp--preset--color--base-alt);
	font-weight: 600;
}

/* Expandable details (e.g. Selected references). */
.wp-block-details summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--wp--preset--color--primary);
	min-height: 44px;
	display: list-item;
	padding-block: 0.6rem;
}

/* Portrait photo (carabiners): keep it a sensible size on small screens. */
.wp-block-image.fg-portrait {
	max-width: 28rem;
	margin-inline: auto;
}

/* Small source diagrams are shown no wider than their natural size. */
.wp-block-image.fg-diagram-natural {
	max-width: 617px;
	margin-inline: auto;
}

/* Wide diagram (domains): shown no wider than its natural 875px. */
.wp-block-image.fg-diagram-wide {
	max-width: 875px;
	margin-inline: auto;
}

/* When a page ends with a full-width band (e.g. "Continue exploring"),
   let it meet the footer without an ivory gap. */
.wp-site-blocks main:has(> .wp-block-post-content > .alignfull:last-child) {
	padding-bottom: 0 !important;
}

/* ------------------------------------------------------------------
 * 11. Shrinking sticky header (enabled by assets/js/header.js)
 * ------------------------------------------------------------------ */
.fg-sticky .wp-site-blocks > header.wp-block-template-part > .fg-header {
	position: fixed;
	top: var(--wp-admin--admin-bar--height, 0px);
	left: 0;
	right: 0;
	z-index: 50;
	transition: padding 0.25s ease, top 0.25s ease, box-shadow 0.25s ease;
}

.fg-sticky .fg-header .wp-block-site-logo img {
	max-width: var(--wp--custom--logo--header-desktop-max-width, 160px);
	transition: max-width 0.25s ease;
}

/* Compact state */
.fg-header-is-compact .fg-header {
	padding-top: 0.5rem !important;
	padding-bottom: 0.5rem !important;
	box-shadow: 0 1px 0 var(--wp--preset--color--base-alt), 0 4px 12px rgb(24 49 63 / 0.06);
}

html.fg-sticky.fg-header-is-compact .fg-header .wp-block-site-logo img {
	max-width: var(--wp--custom--header--compact-logo-width, 56px);
}

@media (max-width: 899px) {
	.fg-sticky .fg-header .wp-block-site-logo img {
		max-width: var(--wp--custom--logo--header-tablet-max-width, 112px);
	}

	html.fg-sticky.fg-header-is-compact .fg-header .wp-block-site-logo img {
		max-width: var(--wp--custom--header--compact-logo-width-small, 48px);
	}
}

@media (max-width: 599px) {
	.fg-sticky .fg-header .wp-block-site-logo img {
		max-width: var(--wp--custom--logo--header-mobile-max-width, 100px);
	}

	/* The admin toolbar scrolls away on phones; the header follows it up. */
	.fg-header-is-compact .wp-site-blocks > header.wp-block-template-part > .fg-header {
		top: 0;
	}
}

/* 600-699px: the full-size header stacks; the compact one fits in one row. */
@media (min-width: 600px) and (max-width: 699px) {
	.fg-header-is-compact .fg-header__inner {
		flex-wrap: nowrap !important;
		justify-content: space-between !important;
	}

	.fg-header-is-compact .fg-header__inner .wp-block-navigation {
		flex-basis: auto;
	}

	.fg-header-is-compact .fg-header__inner .wp-block-navigation__container {
		column-gap: 0.5rem;
	}
}

/* Keep in-page links and keyboard focus clear of the compact header. */
html.fg-sticky {
	scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 5.5rem);
}

/* ------------------------------------------------------------------
 * 12. Form fields: visible outlines everywhere (WCAG 1.4.11: 3:1)
 * ------------------------------------------------------------------ */
:where(
	input:not([type="submit"], [type="button"], [type="reset"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="image"], [type="hidden"]),
	select,
	textarea
) {
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	border: 1px solid var(--wp--preset--color--secondary);
	border-radius: var(--wp--custom--radius--small);
	padding: 0.6rem 0.75rem;
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.4;
	min-height: 44px;
	max-width: 100%;
}

:where(input, select, textarea)::placeholder {
	color: var(--wp--preset--color--secondary-text);
	opacity: 1;
}

:where(
	input:not([type="submit"], [type="button"], [type="reset"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="image"], [type="hidden"]),
	select,
	textarea
):focus-visible {
	border-color: var(--wp--preset--color--primary);
	border-width: 2px;
}

:where(input, select, textarea)[aria-invalid="true"] {
	border-color: var(--wp--preset--color--contrast);
	border-width: 2px;
	border-style: dashed;
}

/* Core search block: outline the field, not the wrapper. */
.wp-block-search__inside-wrapper {
	gap: 0.5rem;
}

/* ------------------------------------------------------------------
 * 13. Links that open a new tab: a small visual marker, also spoken.
 * ------------------------------------------------------------------ */
:where(main, footer) a[target="_blank"]::after {
	content: " \2197";
	content: " \2197" / " (opens in a new tab)";
	font-size: 0.85em;
}

/* Domain Interactions diagram: never wider than its natural 694px. */
.wp-block-image.fg-diagram-interactions {
	max-width: 694px;
	margin-inline: auto;
}

/* Below 1024px, stack the "A system, not a checklist" section so the
   Domain Interactions diagram can display near its full size. */
@media (max-width: 1023px) {
	.wp-block-columns:has(.fg-diagram-interactions) {
		flex-wrap: wrap !important;
	}

	.wp-block-columns:has(.fg-diagram-interactions) > .wp-block-column {
		flex-basis: 100% !important;
	}
}
