/*
Theme Name: Colibris
Description: A child theme of twentytwentyfive, scaffolded by Studio Code.
Template: twentytwentyfive
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 7.2
Version: 0.1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: colibris
Tags: full-site-editing, block-patterns, block-styles, wide-blocks, accessibility-ready, style-variations
*/

/* ==========================================================================
   Avada shortcode conversion
   --------------------------------------------------------------------------
   Fusion Builder containers became full-bleed "Section" groups. Sections own
   their vertical rhythm, so neighbouring bands butt edge-to-edge instead of
   inheriting the theme's block gap between them.
   ========================================================================== */

.wp-block-post-content > .wp-block-group + .wp-block-group {
	margin-block-start: 0;
}

.is-style-section {
	padding-block: var(--wp--preset--spacing--60);
}

.is-style-section-tight {
	padding-block: var(--wp--preset--spacing--40);
}

/* Sections that paint a background keep the page gutter at every width. */
.is-style-section.has-background,
.is-style-section-tight.has-background {
	padding-inline: var(--wp--style--root--padding-left) var(--wp--style--root--padding-right);
}

/* --------------------------------------------------------------------------
   Front page title band
   --------------------------------------------------------------------------
   The band is a logo-and-title strip: the logo sits at full size on the left
   with the title beside it, so the logo sets the band's height and the headings
   keep the theme's own scale. Only the Section padding and the gap between the
   two headings are tuned here -- the conversion inherited the full Section
   rhythm of 70px above and below, which is what made the band twice the height
   it needs. Scoped to the front page's first section, so every other Section on
   the site keeps its own rhythm.
   -------------------------------------------------------------------------- */

.home .wp-block-post-content > .is-style-section:first-child {
	--wp--style--block-gap: 0.6rem;
	padding-block: var(--wp--preset--spacing--40);
}

/* Avada's short solid separator (sep_color #ef9a3d, 60px wide). */
.wp-block-separator.is-style-accent {
	width: 60px;
	margin-inline: auto;
	border: 0;
	border-block-start: 1px solid var(--wp--preset--color--colibris-orange);
	background-color: var(--wp--preset--color--colibris-orange);
	opacity: 1;
}

/* Third-party embeds preserved from the Avada [fusion_code] blocks (Google
   Forms/Docs/Drive, Looker Studio, Awesome Table, Mailchimp, PayPal). They are
   rendered by the colibris_* shortcodes in functions.php and must not overflow
   their column. */
.colibris-embed-frame {
	max-width: 100%;
	overflow-x: auto;
}

.colibris-embed-frame iframe {
	display: block;
	width: 100%;
	border: 0;
}

/* Reserve room for the Awesome Table grid before its loader script runs. */
.colibris-awesome-table {
	min-height: 20rem;
}

/* --------------------------------------------------------------------------
   Embedded tables (Annuaire)
   --------------------------------------------------------------------------
   A table dropped into a page arrives wrapped in its own block, and the
   constrained layout caps every direct child at the 645px reading measure --
   which is why the Annuaire grid sits in a narrow column. Release the block
   that holds a table so it can use the whole page, and let it scroll sideways
   instead of squeezing its columns on a narrow screen. Matched on the table
   itself rather than on a plugin's class names, so the rule holds whatever
   renders the grid.
   -------------------------------------------------------------------------- */

/* Core table blocks keep their own width; this targets the wrapper a plugin
   (or a bare table) brings with it. */
.wp-block-post-content > .wp-block-group > *:not(.wp-block-table):has(> table),
.wp-block-post-content > .wp-block-group > *:not(.wp-block-table):has(> .tablepress),
.wp-block-post-content > .wp-block-group > *:not(.wp-block-table):has(.tablepress) {
	max-width: none;
	width: 100%;
	overflow-x: auto;
}

.wp-block-post-content .tablepress,
.wp-block-post-content table.tablepress {
	width: 100%;
}

/* FAQ page: keep each question with its answer. The theme applies one uniform
   block gap, so an answer sits as far from its own question as the next
   question does from the answer above it, and the pairs stop reading as pairs.
   Scoped to the page so no other section's rhythm moves. */
.page-id-209 .wp-block-group.is-style-section > .wp-block-heading + .wp-block-paragraph {
	margin-block-start: 0.4rem;
}

.page-id-209 .wp-block-group.is-style-section > .wp-block-heading {
	margin-block-start: 2.2rem;
}

.page-id-209 .wp-block-group.is-style-section > .wp-block-heading:first-child {
	margin-block-start: 0;
}

.colibris-signup,
.colibris-paypal {
	max-width: 32rem;
	margin: 0 auto;
	padding: var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--colibris-orange-pale);
	border-radius: 4px;
	background-color: var(--wp--preset--color--colibris-surface-cream);
	text-align: center;
}

.colibris-signup__title {
	margin-block-start: 0;
}

.colibris-signup__field input {
	width: 100%;
}

.colibris-signup__submit {
	margin-block-end: 0;
}

/* Legacy schedule tables filled their column in Avada. */
.wp-block-table table {
	width: 100%;
}

/* Converted icon rows (fusion_imageframe + heading links) read better as a
   centred tile than as a bare stacked image and link. */
.colibris-tile {
	text-align: center;
}

.colibris-tile img {
	margin-inline: auto;
}

/* ==========================================================================
   Header navigation
   --------------------------------------------------------------------------
   The main menu is a CLASSIC menu rendered by [colibris_menu], not a
   Navigation block: the block converts menu items into inner blocks and so
   never runs the wp_nav_menu_objects filter that IF Menu's per-item conditions
   hook. Rendered classically, those conditions apply.

   A horizontal bar with hover dropdowns on wide screens; a CSS-only
   disclosure on narrow ones, so no JavaScript is needed for touch.
   ========================================================================== */

.colibris-menu {
	position: relative;
	font-size: var(--wp--preset--font-size--small, 0.9rem);
	line-height: 1.3;
}

.colibris-menu__list,
.colibris-menu__list ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.colibris-menu__list a {
	display: block;
	padding: 0.4em 0;
	color: inherit;
	text-decoration: none;
}

.colibris-menu__list a:hover,
.colibris-menu__list a:focus {
	color: var(--wp--preset--color--colibris-orange);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* The section you are in carries the accent, as it did in the old theme. */
.colibris-menu__list .current-menu-item > a,
.colibris-menu__list .current-menu-ancestor > a {
	color: var(--wp--preset--color--colibris-orange);
	font-weight: 600;
}

/* --- narrow screens: checkbox disclosure -------------------------------- */

.colibris-menu__toggle-button {
	display: inline-block;
	padding: 0.4em 0.9em;
	border: 1px solid var(--wp--preset--color--colibris-orange-pale);
	border-radius: 4px;
	cursor: pointer;
	user-select: none;
}

.colibris-menu__list {
	display: none;
	padding-block-start: var(--wp--preset--spacing--30);
}

.colibris-menu__checkbox:checked ~ .colibris-menu__list {
	display: block;
}

.colibris-menu__list .sub-menu {
	padding-inline-start: var(--wp--preset--spacing--30);
}

/* --- wide screens: horizontal bar with dropdown submenus ---------------- */

@media (min-width: 782px) {
	.colibris-menu__toggle-button {
		display: none;
	}

	.colibris-menu__list,
	.colibris-menu__checkbox:checked ~ .colibris-menu__list {
		display: flex;
		flex-wrap: wrap;
		justify-content: flex-end;
		gap: var(--wp--preset--spacing--20, 1rem) var(--wp--preset--spacing--30);
		padding-block-start: 0;
	}

	.colibris-menu__list li {
		position: relative;
	}

	/* Submenus open on pointer hover and on keyboard focus. */
	.colibris-menu__list .sub-menu {
		position: absolute;
		inset-inline-end: 0;
		inset-block-start: 100%;
		z-index: 20;
		display: none;
		min-width: 15rem;
		padding: var(--wp--preset--spacing--30);
		border: 1px solid var(--wp--preset--color--colibris-orange-pale);
		border-radius: 4px;
		background-color: var(--wp--preset--color--base);
		box-shadow: 0 6px 20px rgb(0 0 0 / 12%);
		text-align: start;
	}

	.colibris-menu__list li:hover > .sub-menu,
	.colibris-menu__list li:focus-within > .sub-menu {
		display: block;
	}

	/* Third level opens beside its parent rather than over the page. */
	.colibris-menu__list .sub-menu .sub-menu {
		inset-inline-end: 100%;
		inset-block-start: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.colibris-menu *,
	.colibris-menu *::before,
	.colibris-menu *::after {
		transition: none;
		animation: none;
	}
}
