/*
 * layout.css — the page shell: header, menu, footer, the width model, and
 * the scissors between sections.
 *
 * Every number is live's, read off the old site's templates and measured in
 * the as-live copy at each band (C:\Dev\wp-joemorgan\inventory\measure).
 */

/* --- Width is the template's statement --- */

/*
 * Every direct child of .site-main declares itself. On this site every
 * template's sections run edge to edge and pad themselves (`alignfull`),
 * because live's do: there is no measure-width column anywhere. The
 * declarations stay so that a new template that forgets one is visible.
 */
.site-main > .measure {
	max-width: var(--jm-measure);
	margin-inline: auto;
}

.site-main > .alignwide {
	max-width: var(--wp--style--global--wide-size, 100%);
	margin-inline: auto;
}

.site-main > .alignfull {
	max-width: none;
}

.site-main > .navigation {
	max-width: var(--jm-measure);
	margin-inline: auto;
}

/* --- Header --- */

/*
 * 50px all round (30 from 1024px, 20 on a phone); the name left, the menu
 * right. 146px tall on a desktop: the menu's 46px items set the height.
 */
.site-header {
	position: relative;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0;
	padding: var(--jm-pad);
}

.site-title {
	flex: 0 0 auto;
	margin: 0;
	font-family: var(--wp--preset--font-family--sans);
	font-size: 32px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 2px;
	text-transform: uppercase;
}

.site-title a {
	color: var(--wp--preset--color--accent);
}

@media (max-width: 1024px) {
	.site-title {
		font-size: 24px;
	}
}

@media (max-width: 767px) {
	.site-title {
		font-size: 20px;
	}
}

/* --- Menu --- */

.site-navigation {
	display: flex;
	justify-content: flex-end;
}

.site-navigation .menu {
	display: flex;
	gap: 50px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-navigation .menu a {
	display: block;
	padding-block: 13px;
	color: var(--wp--preset--color--foreground);
	font-family: var(--wp--preset--font-family--sans);
	font-size: 24px;
	font-weight: 500;
	line-height: 20px;
	letter-spacing: 2px;
	text-transform: uppercase;
	transition: color 0.3s;
}

.site-navigation .menu a:hover,
.site-navigation .menu a:focus-visible,
.site-navigation .menu .current-menu-item > a:not([href*="#"]),
.site-navigation .menu a.is-current {
	color: var(--wp--preset--color--accent);
}

.nav-toggle {
	display: none;
}

/*
 * From 1024px down: a toggle, outlined in cyan, opening a full-width white
 * panel under the header — items in Totally 16px, cyan behind on hover.
 */
@media (max-width: 1024px) {
	.nav-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 3.5px;
		border: 1px solid var(--wp--preset--color--accent);
		border-radius: 3px;
		background: var(--wp--preset--color--background);
		color: var(--wp--preset--color--accent);
		cursor: pointer;
	}

	.nav-toggle svg {
		display: block;
		width: 20px;
		height: 20px;
	}

	.nav-toggle .nav-toggle__close,
	.site-navigation[data-open="true"] .nav-toggle .nav-toggle__open {
		display: none;
	}

	.site-navigation[data-open="true"] .nav-toggle .nav-toggle__close {
		display: block;
	}

	.site-navigation .menu {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		display: none;
		flex-direction: column;
		gap: 0;
		background: var(--wp--preset--color--background);
	}

	.site-navigation[data-open="true"] .menu {
		display: flex;
	}

	.site-navigation .menu a {
		padding: 10px 20px;
		font-size: 16px;
		line-height: 20px;
	}

	.site-navigation .menu a:hover,
	.site-navigation .menu a:focus-visible {
		background: var(--wp--preset--color--accent);
		color: var(--wp--preset--color--background);
	}
}

@media (max-width: 767px) {
	.nav-toggle svg {
		width: 16px;
		height: 16px;
	}
}

/* --- Smooth scrolling, and the progress bar --- */

/*
 * The front page's menu items are anchors (#films, #editing …); they
 * glide unless the reader has asked for less motion. The header is not
 * sticky, so a target needs no offset. Not on live — added 2026-10-01 to
 * match kerrygodliman and edinburghbooks2026.
 */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

/*
 * The reading-progress bar (assets/js/progress.js), as on kerrygodliman and
 * edinburghbooks2026: a 4px strip of the accent colour whose width tracks
 * the scroll. The header scrolls away, so the bar is fixed to the top of
 * the viewport, above everything including the open menu.
 */
.scroll-progress {
	position: fixed;
	top: 0;
	right: 0;
	left: 0;
	z-index: 20;
	height: 4px;
	background: transparent;
	pointer-events: none;
}

.scroll-progress__bar {
	display: block;
	width: 0;
	height: 100%;
	background: var(--wp--preset--color--accent);
}

/* --- Footer --- */

/*
 * Two thirds and a third: the copyright left, the site credit right.
 * Halves from 1024px; stacked and centred on a phone.
 */
.site-footer {
	display: flex;
	align-items: flex-start;
	gap: 0;
	padding: var(--jm-pad);
}

.site-info {
	flex: 0 0 66.66%;
	margin: 0;
}

.site-credit {
	flex: 0 0 33.33%;
	margin: 0 0 0.9rem;
	text-align: right;
}

@media (max-width: 1024px) {
	.site-info,
	.site-credit {
		flex-basis: 50%;
	}
}

@media (max-width: 767px) {
	.site-footer {
		flex-direction: column;
		align-items: center;
	}

	.site-info,
	.site-credit {
		flex-basis: auto;
		text-align: center;
	}
}

/* --- Cut here --- */

/*
 * The scissors and the dashed line. Measured: on a desktop the scissors
 * are 40px wide, 25px in and 10px down, and the 2px line runs from 55px
 * to the page's right padding, 29px down; from 1024px, 30px scissors and
 * the line 33px down; on a phone, 20px scissors and a 1px line.
 */
.jm-cut {
	--cut-h: 61px;
	--cut-x: 25px;
	--cut-y: 10px;
	--cut-w: 40px;
	--cut-line-x: 55px;
	--cut-line-y: 29px;
	--cut-line: 2px;
	position: relative;
	height: var(--cut-h);
}

.jm-cut__scissors {
	position: absolute;
	left: var(--cut-x);
	top: var(--cut-y);
	width: var(--cut-w);
	height: auto;
}

.jm-cut__line {
	position: absolute;
	left: var(--cut-line-x);
	right: var(--jm-pad);
	top: var(--cut-line-y);
	border-top: var(--cut-line) dashed var(--wp--preset--color--foreground);
}

@media (max-width: 1024px) {
	.jm-cut {
		--cut-h: 65px;
		--cut-x: 15px;
		--cut-y: 18px;
		--cut-w: 30px;
		--cut-line-x: 40px;
		--cut-line-y: 33px;
	}
}

@media (max-width: 767px) {
	.jm-cut {
		--cut-h: 17px;
		--cut-x: 10px;
		--cut-y: 6px;
		--cut-w: 20px;
		--cut-line-x: 25px;
		--cut-line-y: 16px;
		--cut-line: 1px;
	}
}

/*
 * About's copy of the module had drifted: its line starts 10px further left
 * and sits 4px lower (2px from 1024px, 1px on a phone).
 */
.jm-cut--about {
	--cut-line-x: 45px;
	--cut-line-y: 33px;
}

@media (max-width: 1024px) {
	.jm-cut--about {
		--cut-line-x: 30px;
		--cut-line-y: 35px;
	}
}

@media (max-width: 767px) {
	.jm-cut--about {
		--cut-line-x: 25px;
		--cut-line-y: 17px;
	}
}
