/*
Theme Name: Frappe Theme
Theme URI: https://geoneo.co.uk
Author: Mr Geo Neo
Author URI: https://geoneo.co.uk
Description: A custom block theme built from scratch.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: frappe-theme
Domain Path: /languages
*/

/* ==========================================================================
   3. CUSTOM SCROLLBARS
   ========================================================================== */

/* Webkit / Chromium Browsers */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
	width: 8px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
	background: transparent;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
	background-color: var(--wp--preset--color--grey-mid);
	border-radius: 4px;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
	background-color: var(--wp--preset--color--grey-mid-light);
}

/* Firefox */
html,
body {
	scrollbar-gutter: stable;
	scrollbar-width: thin;
	scrollbar-color: var(--wp--preset--color--grey-mid) transparent;
}

/* ==========================================================================
   1. GLOBAL LAYOUT & GRID DEFAULTS
   ========================================================================== */

body .is-layout-grid {
	gap: 2rem;
}

.wp-site-blocks {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
}

/* ==========================================================================
   2. HEADER & BRANDING ELEMENTS
   ========================================================================== */

.wp-block-group:has(> .wp-block-site-logo) {
	gap: 1rem;
}

.wp-block-site-logo img {
	width: 96px;
}

.wp-block-site-title {
	font-family: var(--wp--preset--font-family--secondary);
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.5;
}

/* ==========================================================================
   3. POST QUERY & POST ITEM TYPOGRAPHY
   ========================================================================== */

.wp-block-post-template-is-layout-grid .wp-block-group {
	gap: 8px;
}

.wp-block-post-title {
	font-family: var(--wp--preset--font-family--secondary);
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.5;
}

.wp-block-post-title a {
	color: var(--wp--preset--color--grey-light);
	text-decoration: none;
}

p a {
	color: var(--wp--preset--color--grey-mid-light);
	text-decoration: none;
	border-bottom: 1px dotted;
}

p a:hover {
	border-bottom: none;
}

/* Core Quote Block */
.wp-block-quote,
.wp-block-quote p {
	font-family: var(--wp--preset--font-family--primary);
	font-style: italic;
}

/* ==========================================================================
   4. FOOTER TEMPLATE PART
   ========================================================================== */

footer.wp-block-template-part {
	grid-column: 1 / span 6;
	margin: 2rem;
	padding-block: .5rem;
	border-top: 1px solid var(--wp--preset--color--grey-mid-dark);
	color: var(--wp--preset--color--grey-mid-light);
}

/* ==========================================================================
   5. GENERAL TYPOGRAPHY & FONT UTILITIES
   ========================================================================== */

p {
	max-width: 70ch;
}

b,
strong {
	font-weight: 640;
}

.has-small-font-size { 
	line-height: 1.333;
	margin-block-end: 1.333em;
}

.has-medium-font-size { 
	line-height: 1.5;
	margin-block-end: 1.5em;
}

.has-large-font-size { 
	line-height: 1.6;
	margin-block-end: 1.6em;
}

.has-x-large-font-size { 
	line-height: 1.2;
	margin-block-end: 1.2em;
}

.wp-block-separator {
	border: none;
    border-top: 1px solid;
}

/* ==========================================================================
   Page & Image Transitions
   ========================================================================== */

/* Page Transition Overlay */
.page-transition-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-color: var(--wp--preset--color--grey-dark);
	z-index: 999999;
	pointer-events: none;
	opacity: 1;
	transition: opacity 0.6s ease-in-out;
}

/* Page Loaded / Exiting States */
body.page-loaded .page-transition-overlay {
	opacity: 0;
}

body.page-exiting .page-transition-overlay {
	opacity: 1;
	pointer-events: auto;
}

/* Image Fade-In Effect */
img {
	opacity: 0;
	transition: opacity 0.6s ease-out;
	will-change: opacity, transform;
}

img.is-loaded {
	opacity: 1;
}

/* ==========================================================================
   7. NAVIGATION BLOCK CSS RESET
   ========================================================================== */

/* Base navigation container & list resets */
.wp-block-navigation,
.wp-block-navigation ul,
.wp-block-navigation li {
	margin: 0;
	padding: 0;
	font-size: var(--wp--preset--font-size--normal);
	list-style: none;
	background: none;
	border: none;
	box-shadow: none;
	gap: 1rem;
}

/* Link resets & hover interactions */
.wp-block-navigation a {
	text-decoration: none;
	color: inherit;
	background: none;
	margin: 0;
	padding: 0;
}

.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content {
	color: var(--wp--preset--color--grey-mid-light);
}

.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--grey-light);
}

/* Strip block layout wrapper overrides */
.wp-block-navigation__responsive-container-content {
	margin: 0 !important;
	padding: 0 !important;
}

.wp-block-navigation__responsive-container.is-menu-open li {
	font-size: var(--wp--preset--font-size--large);
}

/* ==========================================================================
   PROJECTS
   ========================================================================== */

.page-resources .is-layout-grid,
.blog .is-layout-grid {
	--max-cols: 3;
	--gap: 2rem;
	--min: 312px;
	grid-template-columns: repeat(
		auto-fill, 
		minmax(
		max(var(--min), calc((100% - (var(--max-cols) - 1) * var(--gap)) / var(--max-cols))), 
		1fr
		)
	);	
}

/* ==========================================================================
   PROFILE
   ========================================================================== */

.page-profile .wp-block-separator{
	margin-top: 8rem;
}

/* ==========================================================================
   RESOURCE SECTION & CARD GRID
   ========================================================================== */

.page-resources {
	background-color: var(--wp--preset--color--grey-light);
    color: var(--wp--preset--color--grey-dark);
}

.page-resources a {
	color: var(--wp--preset--color--grey-dark);
}

.page-resources .wp-block-separator,
.page-resources header,
.page-resources footer.wp-block-template-part {
	border-color: var(--wp--preset--color--grey-mid);
}

.page-resources .wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content,
.page-resources footer.wp-block-template-part {
	color: var(--wp--preset--color--grey-mid-dark);
}

.page-resources .wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--grey-dark);
}

.resource-section {
 border-top: 1px solid var(--wp--preset--color--grey-mid);
}

.resource-section:first-of-type {
	margin-top: 0;
}

.resource-section > .wp-block-heading {
	margin-block: 2rem;
	line-height: 1;
}

.resource-card {
	display: flex;
	flex-direction: column;
	height: 100%;
    padding: 1rem;
	background: var(--wp--preset--color--white);
}

/* 1. Fixed Container with Cover Image Fit */
.resource-card-image {
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.resource-card-image a {
	display: block;
	width: 100%;
	height: 100%;
}

.resource-cover-image {
	width: 100%;
	height: 100%;
	object-fit: cover; /* Equivalent to background-size: cover for <img> elements */
	object-position: center;
}

.resource-card-title {
	font-weight: 600;
}

/* Excerpt Spacer */
.resource-card .wp-block-post-excerpt {
	margin-bottom: 1rem;
	flex-grow: 1; /* Pushes the footer row down cleanly to the bottom */
}

/* 4. Footer: Favicon / URL / External Icon */
.resource-card-footer {
	margin-top: auto;
	padding-block-start: 1rem;
    border-top: 1px solid var(--wp--preset--color--grey-mid);
}

.resource-footer-link {
	display: flex;
	align-items: center;
	gap: 8px;
	text-decoration: none;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--grey-mid-dark);
}

.resource-favicon {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

.resource-domain {
	overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-external-icon {
	margin-left: auto;
	font-size: var(--wp--preset--font-size--normal);
}

/* ==========================================================================
   8. RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Desktop Layout Grid (>= 1001px) */
@media screen and (min-width: 1001px) {

	header {
		grid-column: 1 / span 1;
		min-width: 184px;
		margin: 2rem;
		border-right: 1px solid var(--wp--preset--color--grey-mid-dark);
	}

	main {
		grid-column: 2 / span 5;
		margin: 2rem;
	}

	header > .wp-block-group {
		position: fixed;
	}
	.wp-site-blocks > :first-child {
		margin-top: 2rem;
		margin-right: 0;
	}

}

/* Mobile Layout Grid (<= 1000px) */
@media screen and (max-width: 1000px) {
 
	/* Hide the horizontal menu container */
	.wp-block-navigation:not(.has-responsive-menu-open) .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none !important;
	}

	/* Display the hamburger menu button */
	.wp-block-navigation:not(.has-responsive-menu-open) .wp-block-navigation__responsive-container-open {
		display: flex !important;
	}

	main {
		grid-column: 1 / span 6;
		margin: 1rem !important;
		padding-top: 96px;
	}

	header {
		position: fixed;
        width: stretch;
        z-index: 99;
		grid-column: 1 / span 6;
        box-sizing: border-box;
		height: 96px;
		padding-block: 1rem;
		margin: 0 1rem;
		border-bottom: 1px solid var(--wp--preset--color--grey-mid-dark);
		background-color: var(--wp--preset--color--grey-dark);
	}

	.page-resources header {
		background-color: var(--wp--preset--color--grey-light);
	}

	header > .wp-block-group {
		display: grid;
		align-items: center;
		/* grid-template-columns: repeat(3, 1fr); */
	}

	.wp-block-navigation__responsive-container-close {
		top: 20px;
	}

	.is-menu-open .wp-block-navigation__responsive-close {
		padding: 1rem;
	}

	.wp-block-navigation__responsive-container.is-menu-open:where(:not(.disable-default-overlay)) .wp-block-navigation__responsive-container-content {
		position: relative;
		top: 20px;
	}

	.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content {
		color: var(--wp--preset--color--grey-mid-dark);
	}

	.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content:hover {
		color: var(--wp--preset--color--grey-dark);
	}

	.wp-block-navigation__responsive-dialog {
		justify-content: center;
	}

	.wp-block-group:has(> .wp-block-site-logo) {
		grid-column: 1 / span 1;
		flex-direction: row;
		align-items: center;
		align-content: center;
	}

	.wp-block-site-logo img {
		width: 64px;
	}

	header > .wp-block-group nav {
		grid-column: 2 / span 1;
		align-content: end;
	}

	footer.wp-block-template-part {
		margin: 1rem;
	}

		body .is-layout-grid {
		gap: 1rem;
	}

	.page-resources .is-layout-grid,
	.blog .is-layout-grid {
		--max-cols: 2;
  		--gap: 1rem;
	}
	.page-resources .is-layout-grid {
		--min: 156px;
	}

}