/*
Theme Name: nancyjo-theme
Theme URI: https://nancyjosales.com
Author:
Author URI:
Description: Block theme for author and journalist Nancy Jo Sales. Colours, fonts and spacing live in theme.json; this file only holds the homepage layout and a few rules theme.json cannot express.
Requires at least: 7.0
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nancyjo-theme
Tags: block-theme, full-site-editing
*/

/* Short pages: keep the footer at the bottom of the window. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: calc(100svh - var(--wp-admin--admin-bar--height, 0px));
}

.wp-site-blocks > main {
	flex-grow: 1;
}

/* Menu: the current page is yellow (menu links inherit their item's colour). The homepage menu stays white, as designed. */
.njs-header .current-menu-item {
	color: var(--wp--preset--color--yellow);
}

/* Inner-page headers: logo and menu stack and centre on small screens. */
@media (max-width: 781px) {
	.njs-header {
		flex-direction: column;
	}

	.njs-header .wp-block-navigation {
		justify-content: center;
	}
}

/* Phones: keep all six menu items on one line. */
@media (max-width: 600px) {
	.wp-site-blocks .wp-block-navigation {
		font-size: 3.5vw;
		gap: 0.75em;
	}
}

/* Stories: the whole card follows its title link. */
.njs-story {
	position: relative;
}

.njs-story .wp-block-heading a::after {
	content: "";
	position: absolute;
	inset: 0;
}

/* Contact form (Gravity Forms, Orbital theme): site fonts, a lilac "(Required)" and the theme's button style. Colours are set in functions.php. */
.wp-site-blocks .gform-theme--framework {
	--gf-font-family-base: var(--wp--preset--font-family--minion);
	--gf-ctrl-label-color-req: var(--wp--preset--color--lilac);
	--gf-ctrl-btn-font-family: var(--wp--preset--font-family--neutra);
	--gf-ctrl-btn-text-transform: uppercase;
	--gf-ctrl-btn-letter-spacing: 0.08em;
}

/* Nothing Personal: keep each promo caption to the width of its image. */
.njs-promo {
	max-width: 200px;
}

/*
 * Homepage. The header (menu + large logo) floats over the full-screen photo, which is a Cover
 * block on the Home page: swap the image and set its focal point there.
 */
.home .wp-site-blocks {
	position: relative;
}

.njs-home-header {
	position: absolute;
	inset: 0 0 auto;
	z-index: 2;
}

.njs-home-header .njs-home-logo {
	position: absolute;
	top: 48vh;
	top: 48svh;
	left: 10.66vw;
	width: clamp(180px, 22.1vw, 560px);
	margin: 0;
	transform: translateY(-50%);
}

.njs-home-logo img {
	width: 100%;
}

.njs-hero {
	min-height: 100vh;
	min-height: 100svh;
}

/* Photo credit: a semi-transparent black box keeps the white text readable on any photo. */
.njs-hero__credit {
	margin: 0;
	padding: 0.3em 0.7em;
	background-color: color-mix(in srgb, var(--wp--preset--color--black) 60%, transparent);
}

/* Landscape: the photo fills the right of the screen and fades into the black on its left edge. */
@media (orientation: landscape) {
	.njs-hero .wp-block-cover__image-background {
		left: auto;
		width: min(69.55vw, 124vh);
		width: min(69.55vw, 124svh);
		-webkit-mask-image: linear-gradient(to right, transparent, #000 12%);
		mask-image: linear-gradient(to right, transparent, #000 12%);
	}
}

/*
 * Portrait: menu and logo centred above the photo, the logo's "j" just overlapping it.
 * Everything is sized from the logo width (half the screen on phones, capped on tablets).
 */
@media (orientation: portrait) {
	:root {
		--njs-logo-width: min(50.4vw, 23svh);
	}

	.njs-home-header .wp-block-navigation {
		justify-content: center;
		font-size: min(3.5vw, 1.375rem);
	}

	.njs-home-header .njs-home-logo {
		top: calc(var(--njs-logo-width) * 0.49);
		left: 50%;
		width: var(--njs-logo-width);
		transform: translateX(-50%);
	}

	.njs-hero .wp-block-cover__image-background {
		top: calc(var(--njs-logo-width) * 1.22);
		height: calc(100% - var(--njs-logo-width) * 1.22);
	}
}
