/**
 * Theme Name:        Our Local Expert Theme
 * Description:       Our Local Expert Theme (Child of 2025)
 * Version:           1.0.1
 * Author:            Egret Digital
 * Author URI:        https://egret.digital/
 * Text Domain:       ole-theme
 * 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
 */

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

/* Highlight current menu item */
nav {
    a {
        border: 2px solid transparent;
    }
	.current-menu-item > a,
	a:hover,
	a:active {
		color: var(--wp--preset--color--custom-ole-orange) !important;
		text-decoration: none !important;
        border-bottom: 2px solid var(--wp--preset--color--custom-ole-orange);
	}
}
/* Add dot between navigation items */
.wp-block-navigation > li:after {
    content: '•';
    display: flex;
    text-align: center;
    padding: 0 0.5em;
}
.wp-block-navigation > li:last-child:after {
    content: '';
}


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


/* Homepage Search (default WP) */
.wp-block-search__inside-wrapper {
    gap: 0.5em;
}
.wp-block-search__button {
    margin-left: 0;
}
@media (min-width: 782px) {
    .search-container {
        padding-left:  1em !important;
        padding-right:  1em !important;
    }
    .wp-block-search__inside-wrapper {
        flex-wrap: wrap;
    }
    .wp-block-search__button {
        padding: 0.5em 1.5em;
    }
}
@media (max-width: 475px) {
    .search-container {
        padding: 0 !important;
        background-color: transparent !important;
    }
    .wp-block-search__inside-wrapper {
        flex-wrap: wrap;
    }
    .wp-block-search__button {
        padding: 0.75em 1.5em;
    }
}


/* Override WP search template styles - most of these seem to be locked within the template */
.search-results {
    .wp-block-query {
        margin-top: var(--wp--preset--spacing--60);

        li {
            padding-bottom: var(--wp--preset--spacing--30);
            border-bottom: 1px dashed #ccc;
        }
    }
    
    li {
        > .wp-block-group {
            padding: 0 !important;
            margin-top: var(--wp--preset--spacing--30);
            width: 100% !important;
            display: flex;
            gap: var(--wp--preset--spacing--30);
            
            @media(max-width: 600px) {
                flex-direction: column;
            }
        }
        
        figure {
            width: 25% !important;
            max-width: unset;
            min-width: 260px;
            margin-left: 0 !important;
            img {
                aspect-ratio: 1 / 1;
                object-fit: cover;
            }
        }
        
        .descrip-wrapper {
            width: 75%;
            margin-left: 0 !important;
            @media(max-width: 600px) {
                width: 100%;
            }
        }
        .descrip-wrapper, h2 {
            padding-top: 0 !important;
            margin-top: 0 !important;
        }
    }
}


/* Gravityforms styles */
body .gform_wrapper .gform_footer input[type=submit] {
    font-family: var(--wp--preset--font-family--albert-sans);
    background-color: var(--wp--preset--color--custom-ole-orange);
    border-width: 1px;
    padding: 1em;
    color: white;
    font-weight: bold;
    letter-spacing: 0.1em;
}

/* Star rating on review business form */
.star-rating {
	--star-background: orange;

	.gfield_radio {
		display: flex;
		flex-direction: row-reverse;
		justify-content: flex-end;
		line-height: 1;
	}
	input {
		position: relative;
    	z-index: 0;
    	opacity: 0;
		height: 0;
		width: 0;
	}
	
	label {
    	z-index: 1;
		padding: 0;
		width: 20px;
		color: transparent !important;
	}
	label::before {
		font-size: 32px;
		content: "★";
		color: #ccc;
		cursor: pointer;
	}

	input:checked ~ label::before {
		color: var(--star-background);
	}

	.gchoice:has(input:checked) ~ .gchoice label::before {
		color: var(--star-background);
	}
	
	.gfield_description {
	    padding-top: 0 !important;
	}
}


/* header background image */
header > .has-background > div {
    background-position: right;
    background-repeat: no-repeat;
    background-size: contain !important;
}


/* Make image full height of column */
.wp-block-column {
    > figure.full-height {
        height: 100%;
    }
    > figure.full-height > img {
        height: 100%;
        object-fit: cover;
    }
    /* Homepage sign image */
    figure.position-fit > img {
        object-position: 69%;
    }
}

/* Single business page */
.contact-details a:not(.wp-block-button__link) {
    text-decoration: underline;
}
.strong {
    font-weight: bold;
}
.bus-logo {
    padding: 0;
}
.bus-logo + h1 {
    margin-top: 0;
}


/* Reviews Slider on each business page */
.reviews-slider {
	overflow: hidden;
	margin-left: 0;
	margin-right: 0;
	padding-left: 0;
	padding-right: 0;
	
	ul {
		display: flex;
		width: auto;
		overflow-x: scroll;
		padding: 0;
		margin-bottom: 0;
	}
	li {
		display: block;
		flex-shrink: 0;
		width: 16em;
		max-width: calc(100% - var(--wp--preset--spacing--30) - 1px);
		height: auto;
		padding: 0 var(--wp--preset--spacing--30);
		border-right: 1px dotted var(--wp--preset--color--custom-ole-light-grey);
		overflow: hidden;
	}
	p {
	    margin: 2px 0;
	}
	.rev-loc {
	    font-weight: 700;
	}
	.rev-date {
	    font-style: italic;
	    font-size: small;
	}
	.rev-text {
	    margin-top: 1em;
	}
	.owners-reply {
	    font-style: italic;
	    margin-top: 1em;
	    padding: 1em 0;
	    font-size: 0.9rem;
	    border-top: 1px solid #ddd;
	}
	
	&.count-1 li {
        width: 100%;
    }
    &.count-2 li {
        width: 46%; /* TODO work out calc */
    }
	li:first-child {
	    padding-left: 0;
	}
	
  ::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 8px rgba(0,0,0,0.1);
	background-color: var(--wp--preset--color--custom-ole-light-grey);
  }
  ::-webkit-scrollbar {
	width: 8px;
	background-color: #F5F5F5;
  }
  ::-webkit-scrollbar-thumb {
	background-color: var(--wp--preset--color--custom-ole-orange);
  }
  
  p {
      font-size: var(--wp--preset--font-size--small);
      line-height: 1.2em;
      margin-top: 0;
  }
}

/* Stars also used outside the slider so don't nest */
.rev-stars {
    width: calc(var(--star-rating) * 20px);
    height: 20px;
    background-image: url('/wp-content/uploads/2025/07/Star.svg');
    background-repeat: repeat-x;
    background-size: 20px auto;
    color: transparent;
    font-size: 0;
}


/* Area archives - list of child trades */
.trades-grid {
	gap: var(--wp--preset--spacing--30);
	align-items: stretch;
}
.trade-item {
	width: calc((100% - 2*(var(--wp--preset--spacing--30)) - 6px)/ 3);
	border: 1px solid var(--wp--preset--color--custom-ole-orange);
	padding: 0;
	a {
		display: block;
		padding: var(--wp--preset--spacing--30);	
	}
	
	@media (max-width: 600px) {
		width: 100%;		
	}
}

/* Trade archives - list of businesses */
span.wp-block-mfb-meta-field-block + span.wp-block-mfb-meta-field-block::before {
    content: ',';
    display: inline-block;
    position: relative;
    right: 0.3em;
}
.read-more {
    line-height: 1.1;
    padding-top: var(--wp--preset--spacing--20);
    padding-right: var(--wp--preset--spacing--40);
    padding-bottom: var(--wp--preset--spacing--20);
    padding-left: var(--wp--preset--spacing--40);
    border-radius: 9999px;
    white-space: nowrap;
}
:root :where(.wp-block-post-terms a) {
    white-space: normal;
}
