/**
 * Theme Name:        Emma's Day Nursery Theme
 * Description:       Emma's Day Nursery (Child of 2025)
 * Version:           1.0.1
 * Author:            Egret Digital
 * Author URI:        https://egret.digital/
 * Text Domain:       emmas-nursery
 * Domain Path:       /assets/lang
 * Tested up to:      6.8
 * License:           GNU General Public License v2.0 or later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * Template:          twentytwentyfive
 */

/* Calculated margin for elements that have full width background or border but constrained width content 
 * Constrain using margin rather than content width as this is fluid within % columns with padding */
body {
	--calculated-padding: 0;
	@media (min-width: 1440px) {
    	--calculated-padding: calc((100vw - 1340px)/2 - 60px); 
	}
}

/* Set z-indexes so footer doesn't sit above main content 
 * (otherwise can't click links overlapped by footer negative margin) */
main {
	z-index: 1;
}
footer {
	z-index: 0;
	position: relative;
}


/* Highlight current menu item */
nav {
	.wp-block-navigation-item__content {
		color: var(--wp--preset--color--custom-emmas-dark-text) !important;
	}
	.current-menu-item > a,
	a:hover,
	a:active {
		color: var(--wp--preset--color--custom-emmas-dark-grey) !important;
	}
}


/* Compress header spacing to fit on mobile */
@media (max-width: 650px) {
	.header-standard {
		.wp-block-columns {
			gap: var(--wp--preset--spacing--20);
		}
		.wp-block-column:first-child {
			margin-left: calc(var(--wp--preset--spacing--30) * -1);
			max-width: 20vw;
		}
		.wp-block-column:last-child {
			margin-right: calc(var(--wp--preset--spacing--30) * -1);
			max-width: 10vw;
		}
	}
}
@media (max-width: 781px) {
	.homepage-ofsted {
        position: absolute;
        right: 0;
        text-align: right;
        top: 0;
        width: 60px !important;
        transform: translate(30px, -30px);
	}
	.site-logo-container {
		max-width: 30vw;
	}
}
.site-logo-container {
	/* Account for transparent padding around the image taking up premium space */
	margin-left: calc(var(--wp--preset--spacing--30) * -1);
}



/* Unset underline on links */
a:not([class]) {
	text-decoration: none;
}


/* Archive pages - core fix for loop images sometimes being wider than containers */
.archive .wp-block-post-featured-image {
	max-width: 100% !important;
	img {
		border-radius: 0 40px;
	}
}
/* Core fix for list items displayed as flex */
.archive .entry-content li {
	display: list-item;
}


/* Media-text limit size of image */
.wp-block-media-text:not(.is-image-fill-element) {
	figure {
		text-align: center;
	}
	img {
		max-width: 490px;
	}
}

/* Calculate margin and padding for media-text blocks on homepage
Where background is full width but content is not */
@media (min-width: 601px) {
	/* Unset full-width background on right when media is on the left */
	.wp-block-group:has(.wp-block-media-text):not(:has(.has-media-on-the-right)) {
		padding-right: 0;
		margin-right: var(--calculated-padding);
	}
	.wp-block-group.has-background:has(.wp-block-media-text):not(:has(.has-media-on-the-right)) {
		padding-left: var(--calculated-padding);
	}
	/* Unset full-width background on left when media is on the right */
	.wp-block-group.has-background:has(.has-media-on-the-right) {
		padding-left: 0;
		margin-left: var(--calculated-padding);
		padding-right: var(--calculated-padding);
	}
}

@media (max-width: 600px) {
	.wp-block-media-text__content {
		padding: var(--wp--preset--spacing--30) 0 !important;
		
		> .wp-block-group {
			padding: 0 !important;
		}
	}
	
	.wp-block-media-text.alignfull .wp-block-media-text__content {
	    padding-left: var(--wp--style--root--padding-left) !important;
	    padding-right: var(--wp--style--root--padding-right) !important;
	}
}

/* Homepage columns with object-fit image. Resize the image */
.object-fit-img-column {
    figure {
        height: 100%;
    
        > img {
            object-fit: cover;
            height: 100%;
        }
    }
}


/* Full width media-content with image reaching edge */
.media-content-fw-img {
    > .wp-block-media-text {
        margin-right: 0; /* Prevent horizontal scroll at laptop width */ 
    }
}


/* Primary buttons custom padding as Beiruti has too much space for descenders compared to ascenders */
.wp-block-button:not(.is-style-outline) .wp-block-button__link {
    padding-top: 4px;
}

/* Secondary button styles */
.is-style-outline > .wp-block-button__link {
    background-image: url(/wp-content/uploads/2025/05/arrow-right.svg);
    background-repeat: no-repeat;
    background-position: right;
	background-size: 40px;
    padding-right: 55px;
    text-align: left;
}


/* Make details (accordions) look like buttons */
.wp-block-details summary {
	color: var(--wp--preset--color--custom-emmas-blue);
	background-color: var(--wp--preset--color--white);
	border-radius: 2rem;
	font-weight: bold;
    padding-top: 5px;
    text-align: center;
}


/* About page - more blocks with calculated padding to accommodate full width bg's */
.full-width-bg {
    .wp-block-column:first-child {
        padding-left: var(--calculated-padding);
    }
    .wp-block-column:last-child {
        padding-right: calc(var(--calculated-padding) + var(--wp--preset--spacing--50));
    }
}

/* About page make grid wrap at narrower width */
.grid-wrap {
	container-name: grid-container;
	container-type: inline-size;
}
@container grid-container (width < 550px) {
	/* Change the flex direction of the .child element. */
	.is-layout-grid { 
		display: flex !important;
		flex-direction: column;
	}
}


/* Day nursery and pre-school pages - table of timetable */
.wp-block-table td, .wp-block-table th {
    min-width: 4em;
}


/* Footer - set negative margin to pull up alongside last block */
.footer-house {
	display: none;
}
@media (min-width: 600px) {
	footer {
		margin-top: -140px;
	}
	.footer-house {
		display: block;
	}
	.last-block-house {
		padding-left: 200px !important;
	}
}

/* About page ofsted logo min width */
.ofsted-min-width {
	min-width: 65px;
}


/* Gravityforms styles - contact form */
#gform_wrapper_1 h2 {
	font-size: var(--wp--preset--font-size--large);
	margin: 0;
}
#gform_1 {
	container: form-container / inline-size;
	
	--gf-form-gap-y: 1.5rem;
}
#gform_1 label {
	--gf-local-font-size: var(--wp--preset--font-size--medium);
	margin: 0;
	text-transform: uppercase;
}
#gform_submit_button_1 {
	--gf-ctrl-btn-radius: 2rem;
	--gf-local-font-size: var(--wp--preset--font-size--medium);
	--gf-local-padding-y: 0.2rem;
	padding-top: 0.4rem; /* Override due to weird unbalanced font */
	--gf-local-padding-x: 3.5rem;
	--gf-ctrl-btn-bg-color-primary: var(--wp--preset--color--custom-emmas-blue);
	--gf-ctrl-btn-border-color-primary: var(--wp--preset--color--custom-emmas-blue);
	--gf-ctrl-btn-border-color-hover-primary: var(--wp--preset--color--custom-emmas-dark-text);
	--gf-ctrl-btn-bg-color-hover-primary: var(--wp--preset--color--custom-emmas-dark-text);
	--gf-ctrl-btn-border-width-primary: 2px;
	--gf-ctrl-btn-font-weight: bold;
	margin: auto;
}
/* Make name, email and phone appear on same line */
@container form-container (width > 560px) {
	#field_1_4 { /* First Name */
		grid-column-start: 1;
		grid-column-end: 7;
	}
	#field_1_7 { /* Second Name */
		grid-column-start: 7;
		grid-column-end: 13;	
	}
}
#input_1_4,
#input_1_2,
#input_1_7 {
	inline-size: auto;
	width: 100%;
}
#input_1_3 {
	height: 6em;
	min-block-size: 6em;
}



/* Homepage custom footer - text overlaid on house shape 
/* Block scrapped
@media (max-width: 605px) {
    .wp-container-core-group-is-layout-4897f5cc {
        background-color: var(--wp--preset--color--custom-emmas-blue);  
    }
    .has-background {
        background-image: unset !important;
    }
}
.homepage-footer {
    @media (min-width: 606px) {
        .wp-block-column:first-child {
            margin-bottom: -1px;
        }
        
        .has-background {
            background-repeat: no-repeat;
            background-position: bottom;
            height: 100%;
            padding-top: 215px !important;
            
            > * {
                max-width: 400px;
                margin: 10px auto;
            }
        }
        .wp-block-button__link {
            font-size: 1.25rem !important;
        }
        p {
            font-size: 1.15rem !important;
        }
     }
 
    @media (max-width: 781px) {
        .wp-block-column:last-child {
            display:none;
        }
    }   
    figure {
        text-align: right;
    }
    img {
        max-width: min(100%, 507px);
        min-width: 155px;
    }
}
*/
