/*
Theme Name: NW1 Interactive
Description: Child theme of Frost for NW1 Interactive. Colors, fonts, spacing and buttons are set in theme.json.
Author: NW1 Interactive
Template: frost
Version: 1.0.4
Requires at least: 6.7
License: GNU General Public License v3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: frost-nw1
*/

/* Even line lengths: no single-word last lines in headings or centred text. */
h1, h2, h3, h4, .has-text-align-center {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

/* Links: underlined in body copy, never colour alone. */
a {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
	border-radius: 2px;
}

/* Brand: "n" mark drawn before the site title link. */
/* Wordmark: "NW1." in 800 with a red period, "Interactive" in 400. Live text. */
.nw1-brand a {
	display: inline-flex;
	align-items: baseline;
	white-space: nowrap;
	color: var(--wp--preset--color--contrast);
	letter-spacing: 0;
}

.nw1-wm-mark {
	font-weight: 800;
	letter-spacing: -0.03em;
}

.nw1-wm-dot {
	color: var(--wp--preset--color--accent);
}

.nw1-wm-name {
	margin-left: 0.18em;
	font-weight: 400;
}

.nw1-brand a:hover {
	color: var(--wp--preset--color--contrast);
}

/* Header navigation: current page gets an underline, hover goes red. */
.site-header .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--accent);
}

.site-header .wp-block-navigation-item__content[aria-current="page"] {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.35em;
}

.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	border: 0;
	padding: 10px;
	margin: -10px;
}

/* Frost turns the open button white on focus/hover inside a coloured group;
   our header is white, so the icon vanished after closing the menu (focus
   returns to it, and touch leaves it in hover). Keep it Ink, red on hover. */
.has-background .wp-block-navigation__responsive-container-open,
.has-background .wp-block-navigation__responsive-container-open:focus {
	color: var(--wp--preset--color--contrast);
}

@media (hover: hover) {
	.has-background .wp-block-navigation__responsive-container-open:hover,
	.wp-block-navigation__responsive-container-close:hover {
		color: var(--wp--preset--color--accent);
	}
}

/* Mobile menu: full-width rows with dividers and an arrow, so it reads as a menu. */
/* Same top and side spacing as the header, so the X lands exactly where the
   menu button was (selector matches core's, which otherwise wins). */
.wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
	padding: 20px var(--wp--style--root--padding-right, 20px) 28px var(--wp--style--root--padding-left, 20px);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	top: 10px;
	right: 10px;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: var(--wp--preset--spacing--medium);
	align-items: stretch;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	align-items: stretch;
	width: 100%;
	gap: 0 !important;
	border-top: 1px solid var(--wp--preset--color--line);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	width: 100%;
	border-bottom: 1px solid var(--wp--preset--color--line);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 600;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 18px 0 !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content::after {
	content: "→";
	font-weight: 400;
	color: var(--wp--preset--color--contrast-2);
	transition: transform 0.2s ease, color 0.2s ease;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover::after {
	color: var(--wp--preset--color--accent);
	transform: translateX(4px);
}

/* Current page: red arrow and no underline (the row already marks it). */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content[aria-current="page"] {
	text-decoration: none;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content[aria-current="page"]::after {
	color: var(--wp--preset--color--accent);
}

/* Image style: simple browser frame for project screenshots. */
.wp-block-image.is-style-browser-frame {
	position: relative;
	padding-top: 28px;
	background: var(--wp--preset--color--base-2);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 10px;
	overflow: hidden;
	transition: border-color 0.2s ease;
}

.wp-block-image.is-style-browser-frame::before {
	content: "";
	position: absolute;
	top: 10px;
	left: 14px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--wp--preset--color--line);
	box-shadow: 14px 0 0 var(--wp--preset--color--line), 28px 0 0 var(--wp--preset--color--line);
}

.wp-block-image.is-style-browser-frame img {
	display: block;
	width: 100%;
	height: auto;
	border-top: 1px solid var(--wp--preset--color--line);
}

/* Case-study photos and documents (not screenshots): thin frame, small caption. */
.wp-block-image.nw1-photo img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 10px;
}

.wp-block-image.nw1-photo .wp-element-caption {
	margin-top: 10px;
	margin-bottom: 0;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--contrast-2);
	text-align: left;
}

/* Photo trio: never two-plus-one; one column on phones, three from 560px. */
.wp-block-group.nw1-photos {
	grid-template-columns: minmax(0, 1fr) !important;
}

@media (min-width: 560px) {
	.wp-block-group.nw1-photos {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	}
}

/* Homepage hero: three client screenshots layered, so it reads as a portfolio. */
.nw1-hero-stack {
	position: relative;
	aspect-ratio: 2.3 / 1;
	max-height: 540px;
}

.nw1-hero-stack > .wp-block-image {
	position: absolute;
	width: 52%;
	margin: 0 !important;
	box-shadow: 0 8px 24px rgb(22 24 29 / 0.08);
}

.nw1-hero-stack > .wp-block-image:nth-child(1) {
	top: 0;
	left: 0;
}

.nw1-hero-stack > .wp-block-image:nth-child(2) {
	top: 0;
	right: 0;
}

.nw1-hero-stack > .wp-block-image:nth-child(3) {
	bottom: 0;
	left: 20%;
	width: 60%;
	z-index: 1;
	box-shadow: 0 24px 60px rgb(22 24 29 / 0.18);
}

@media (max-width: 599px) {
	.nw1-hero-stack {
		aspect-ratio: 1.45 / 1;
	}

	.nw1-hero-stack > .wp-block-image {
		width: 64%;
	}

	.nw1-hero-stack > .wp-block-image:nth-child(3) {
		left: 13%;
		width: 74%;
	}
}

/* Project card: the title link covers the whole card. */
.nw1-card {
	position: relative;
}

.nw1-card h3 a {
	text-decoration: none;
}

.nw1-card h3 a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.nw1-card:hover h3 a {
	text-decoration: underline;
	color: var(--wp--preset--color--accent);
}

.nw1-card .is-style-browser-frame {
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.nw1-card:not(.nw1-card--static):hover .is-style-browser-frame {
	border-color: var(--wp--preset--color--contrast-2);
	box-shadow: 0 14px 32px rgb(22 24 29 / 0.14);
	transform: translateY(-4px);
}

/* Keyboard focus shows on the whole card, not just the title text. */
.nw1-card:has(h3 a:focus-visible) .is-style-browser-frame {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.nw1-card .is-style-browser-frame {
		transition: none;
	}

	.nw1-card:not(.nw1-card--static):hover .is-style-browser-frame {
		transform: none;
	}
}

/* Grids: two-up on tablets instead of core's single stacked column. */
@media (min-width: 600px) and (max-width: 781px) {
	.wp-block-columns.nw1-grid > .wp-block-column {
		flex-basis: calc(50% - var(--wp--preset--spacing--small) / 2) !important;
		flex-grow: 0;
	}
}

/* Work grid: taller row gap than column gap (core grid only takes one value). */
.wp-block-group.nw1-work-grid {
	row-gap: var(--wp--preset--spacing--medium);
}

/* Cards without a label reserve its space, so titles line up across a row. */
@media (min-width: 600px) {
	.nw1-work-grid > .nw1-card:not(:has(.nw1-card-label)) > .wp-block-heading {
		padding-top: calc(var(--wp--preset--font-size--x-small) * var(--wp--custom--line-height--body) + 8px);
	}
}

/* Featured card (Sacred Heart case study): full row; image left, text right on desktop. */
@media (min-width: 600px) {
	.nw1-work-grid > .nw1-card--featured {
		grid-column: 1 / -1;
	}
}

@media (min-width: 782px) {
	.nw1-work-grid > .nw1-card--featured {
		grid-column: 1 / -1;
		display: grid;
		grid-template-columns: 2fr 1fr;
		grid-template-rows: 1fr auto auto auto 1fr;
		column-gap: var(--wp--preset--spacing--medium);
	}

	.nw1-card--featured > .wp-block-image {
		grid-column: 1;
		grid-row: 1 / -1;
		margin: 0 !important;
	}

	.nw1-card--featured > :not(.wp-block-image) {
		grid-column: 2;
	}

	.nw1-card--featured > :nth-child(2) {
		grid-row: 2;
		margin-top: 0 !important;
	}

	.nw1-card--featured > :nth-child(3) {
		grid-row: 3;
	}

	.nw1-card--featured > :nth-child(4) {
		grid-row: 4;
	}

	.nw1-card--featured h3 {
		font-size: var(--wp--preset--font-size--x-large) !important;
	}
}

/* Process steps: number above each step title. */
.nw1-step-number {
	font-variant-numeric: tabular-nums;
}

/* Contact form (Ninja Forms, plugin styles off). */
.nf-form-cont .nf-form-fields-required {
	margin-bottom: 20px;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--contrast-2);
}

.nf-form-cont .nf-field-container {
	margin-bottom: 20px;
}

.nf-form-cont .nf-field-label label {
	display: block;
	margin-bottom: 6px;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.nf-form-cont .ninja-forms-req-symbol {
	color: var(--wp--preset--color--contrast-2);
}

.nf-form-cont input[type="text"],
.nf-form-cont input[type="email"],
.nf-form-cont select,
.nf-form-cont textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--wp--preset--color--contrast-2);
	border-radius: 6px;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
}

.nf-form-cont textarea {
	min-height: 180px;
	resize: vertical;
}

.nf-form-cont input[type="submit"],
.nf-form-cont input[type="button"] {
	padding: 14px 26px;
	border: 1.5px solid var(--wp--preset--color--contrast);
	border-radius: 6px;
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.25;
	cursor: pointer;
}

.nf-form-cont input[type="submit"]:hover,
.nf-form-cont input[type="submit"]:focus-visible {
	border-color: var(--wp--preset--color--contrast-2);
	background: var(--wp--preset--color--contrast-2);
}

.nf-form-cont .nf-error .ninja-forms-field {
	border-color: var(--wp--preset--color--accent);
}

.nf-form-cont .nf-error-msg {
	margin-top: 6px;
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--x-small);
}

.nf-form-cont .nf-response-msg {
	padding: var(--wp--preset--spacing--small);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 10px;
	background: var(--wp--preset--color--base-2);
	font-size: var(--wp--preset--font-size--large);
}

.nf-form-cont .nf-response-msg p {
	margin: 0;
}

.nw1-contact-card > * + * {
	margin-top: 20px;
}

/* Footer links sit in muted text but stay underlined. */
.site-footer a:hover {
	color: var(--wp--preset--color--accent);
}
