/*!
 * NZ Nature — front-end and editor styles.
 * Design tokens live in theme.json; this file adds layout, motifs and
 * block-style treatments that theme.json cannot express.
 */

/* -------------------------------------------------------------------------
 * Base
 * ------------------------------------------------------------------- */
:root {
	--nz-radius: 14px;
	--nz-shadow-soft: 0 12px 30px -18px rgba(11, 42, 32, 0.55);
	--nz-shadow-card: 0 24px 60px -30px rgba(11, 42, 32, 0.45);
}

html {
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
}

body {
	background-color: var(--wp--preset--color--base-2);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

::selection {
	background: var(--wp--preset--color--kowhai);
	color: var(--wp--preset--color--pounamu-deep);
}

a:focus-visible,
button:focus-visible,
.wp-element-button:focus-visible,
input:focus-visible,
textarea:focus-visible {
	outline: 3px solid var(--wp--preset--color--ocean);
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 * Header
 * ------------------------------------------------------------------- */
.wp-block-site-logo img {
	border-radius: 999px;
	box-shadow: var(--nz-shadow-soft);
}

.nz-nature-nav .wp-block-navigation-item__content {
	position: relative;
}

.nz-nature-nav .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	right: 100%;
	bottom: -4px;
	height: 2px;
	background: var(--wp--preset--color--kowhai);
	transition: right 0.25s ease;
}

.nz-nature-nav .wp-block-navigation-item__content:hover::after,
.nz-nature-nav .current-menu-item .wp-block-navigation-item__content::after {
	right: 0;
}

/* -------------------------------------------------------------------------
 * Hero + motif panels (generated SVG art)
 * ------------------------------------------------------------------- */
.nz-hero,
.nz-motif {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

.nz-hero > *,
.nz-motif > * {
	position: relative;
	z-index: 2;
}

.nz-hero::after,
.nz-motif::after {
	content: "";
	position: absolute;
	inset: auto 0 0 0;
	z-index: 1;
	pointer-events: none;
	background-repeat: no-repeat;
	background-position: bottom center;
	background-size: 100% auto;
}

.nz-hero--mountains::after {
	height: min(38%, 260px);
	background-image: url("../images/mountains.svg");
}

.nz-motif--mountains::after {
	height: 55%;
	opacity: 0.45;
	background-image: url("../images/mountains.svg");
}

.nz-motif--fern::after {
	inset: 0;
	height: auto;
	opacity: 0.14;
	background-position: center right;
	background-size: auto 120%;
	background-image: url("../images/fern.svg");
	transform: rotate(8deg);
}

.nz-motif--koru::after {
	inset: 0;
	height: auto;
	opacity: 0.18;
	background-position: center;
	background-size: min(60%, 260px) auto;
	background-image: url("../images/koru.svg");
}

.nz-motif--southern-cross::after {
	inset: 0;
	height: auto;
	opacity: 0.25;
	background-position: top right;
	background-size: min(40%, 220px) auto;
	background-image: url("../images/southern-cross.svg");
}

/* -------------------------------------------------------------------------
 * Block styles
 * ------------------------------------------------------------------- */
.is-style-outline-pounamu .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--pounamu);
	border: 2px solid var(--wp--preset--color--pounamu);
}

.is-style-outline-pounamu .wp-block-button__link:hover,
.is-style-outline-pounamu .wp-block-button__link:focus {
	background: var(--wp--preset--color--pounamu);
	color: var(--wp--preset--color--base);
}

.is-style-driftwood-card {
	box-shadow: var(--nz-shadow-soft);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.is-style-driftwood-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--nz-shadow-card);
}

.wp-block-separator.is-style-wave {
	border: 0;
	height: 14px;
	background: url("../images/wave.svg") repeat-x center / auto 100%;
	opacity: 1;
}

/* -------------------------------------------------------------------------
 * Content
 * ------------------------------------------------------------------- */
.wp-block-post-featured-image img,
.wp-block-image img {
	box-shadow: var(--nz-shadow-soft);
}

.wp-block-post-terms a {
	display: inline-block;
	padding: 0.15em 0.7em;
	border-radius: 999px;
	background: var(--wp--preset--color--limestone);
	color: var(--wp--preset--color--pounamu);
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	text-decoration: none;
}

.wp-block-post-terms a:hover {
	background: var(--wp--preset--color--kowhai);
	color: var(--wp--preset--color--pounamu-deep);
}

.wp-block-post-excerpt__more-link {
	display: inline-block;
	margin-top: 0.75rem;
	font-weight: 600;
	text-decoration: none;
	border-bottom: 2px solid var(--wp--preset--color--kowhai);
}

.nz-comments .wp-block-comment-template > li {
	list-style: none;
}

.nz-comments .wp-block-comments-title,
.nz-comments .wp-block-comment-reply-link a {
	color: var(--wp--preset--color--fern);
}

.nz-inline-title {
	display: inline;
}

/* -------------------------------------------------------------------------
 * Forms
 * ------------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="password"],
textarea {
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--limestone);
	border-radius: 10px;
	padding: 0.65em 0.9em;
	font: inherit;
	color: var(--wp--preset--color--contrast);
}

.wp-block-search.wp-block-search__button-inside .wp-block-search__inside-wrapper {
	border: 1px solid var(--wp--preset--color--limestone);
	border-radius: 999px;
	overflow: hidden;
}

/* -------------------------------------------------------------------------
 * Editor parity
 * ------------------------------------------------------------------- */
.editor-styles-wrapper {
	background-color: var(--wp--preset--color--base-2);
}

/* -------------------------------------------------------------------------
 * Motion / print
 * ------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.001ms !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

@media print {
	.nz-hero::after,
	.nz-motif::after,
	.wp-block-navigation,
	.wp-block-comments {
		display: none !important;
	}
}

/* -------------------------------------------------------------------------
 * Photography — collections & latest photos
 * ------------------------------------------------------------------- */
.nz-collections,
.nz-photos {
	display: grid;
	gap: var(--wp--preset--spacing--40);
}

.nz-collections--cols-1,
.nz-photos--cols-1 { grid-template-columns: 1fr; }
.nz-collections--cols-2,
.nz-photos--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nz-collections--cols-3,
.nz-photos--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nz-collections--cols-4,
.nz-photos--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.nz-collection {
	position: relative;
	display: block;
	min-height: 260px;
	border-radius: 14px;
	overflow: hidden;
	text-decoration: none;
	box-shadow: var(--nz-shadow-soft);
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.nz-collection:hover {
	transform: translateY(-4px);
	box-shadow: var(--nz-shadow-card);
}

.nz-collection__cover {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	filter: brightness(0.82) saturate(1.05);
	transition: transform 0.6s ease;
}

.nz-collection:hover .nz-collection__cover {
	transform: scale(1.06);
}

.nz-collection__body {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	min-height: 260px;
	padding: var(--wp--preset--spacing--40);
	background: linear-gradient(180deg, rgba(11, 42, 32, 0) 35%, rgba(11, 42, 32, 0.88) 100%);
	color: #fff;
}

.nz-collection__name,
.nz-photo__title {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 600;
	line-height: 1.2;
}

.nz-collection__name { font-size: 1.5rem; }

.nz-collection__count,
.nz-photo__meta {
	font-size: 0.8rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.9;
}

.nz-photo {
	display: block;
	border-radius: 14px;
	overflow: hidden;
	background: var(--wp--preset--color--base);
	text-decoration: none;
	color: inherit;
	box-shadow: var(--nz-shadow-soft);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.nz-photo:hover {
	transform: translateY(-4px);
	box-shadow: var(--nz-shadow-card);
}

.nz-photo__img {
	display: block;
	aspect-ratio: 4 / 3;
	background-size: cover;
	background-position: center;
	transition: transform 0.6s ease;
}

.nz-photo:hover .nz-photo__img {
	transform: scale(1.05);
}

.nz-photo__body {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: var(--wp--preset--spacing--30);
}

.nz-photo__title { font-size: 1.15rem; }
.nz-photo__meta { color: var(--wp--preset--color--fern); }

/* -------------------------------------------------------------------------
 * Photography — masonry galleries (query loop + gallery block)
 * ------------------------------------------------------------------- */
.wp-block-post-template.nz-masonry {
	display: block !important;
	column-count: 3;
	column-gap: var(--wp--preset--spacing--40);
}

.wp-block-post-template.nz-masonry > li {
	break-inside: avoid;
	width: 100%;
	margin: 0 0 var(--wp--preset--spacing--40) !important;
	padding: 0;
	list-style: none;
}

.nz-gallery-card {
	box-shadow: var(--nz-shadow-soft);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.nz-gallery-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--nz-shadow-card);
}

.wp-block-gallery.is-style-masonry {
	display: block !important;
	column-count: 3;
	column-gap: var(--wp--preset--spacing--30);
}

.wp-block-gallery.is-style-masonry > figure.wp-block-image {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	flex: none !important;
	break-inside: avoid;
	margin: 0 0 var(--wp--preset--spacing--30) !important;
}

.wp-block-gallery.is-style-masonry > figure.wp-block-image > a,
.wp-block-gallery.is-style-masonry > figure.wp-block-image > div {
	display: block !important;
	width: 100% !important;
}

.wp-block-gallery.is-style-masonry > figure.wp-block-image img {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	object-fit: cover;
	border-radius: 8px;
}

.wp-block-gallery.is-style-tight {
	gap: 3px !important;
}

.wp-block-gallery.is-style-tight img {
	border-radius: 3px;
}

.wp-block-gallery.is-style-full-bleed {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	border-radius: 0;
}

.wp-block-gallery img {
	border-radius: 8px;
}

.wp-block-image.is-style-frameless img {
	box-shadow: none;
	border-radius: 0;
}

/* -------------------------------------------------------------------------
 * Photography — maps
 * ------------------------------------------------------------------- */
.nz-map-wrap {
	margin-top: var(--wp--preset--spacing--40);
}

.nz-map {
	width: 100%;
	border-radius: 14px;
	overflow: hidden;
	background: var(--wp--preset--color--limestone);
	box-shadow: var(--nz-shadow-soft);
	z-index: 0;
}

.nz-map img {
	border-radius: 0;
	box-shadow: none;
}

.nz-map-popup img {
	width: 190px;
	height: auto;
	border-radius: 6px;
	display: block;
	margin-bottom: 0.4rem;
}

.nz-map-popup__title {
	margin: 0;
	font-size: 0.9rem;
	font-weight: 600;
}

.nz-map-empty {
	padding: var(--wp--preset--spacing--40);
	border-radius: 14px;
	background: var(--wp--preset--color--limestone);
	color: var(--wp--preset--color--pounamu);
	text-align: center;
}

@media (max-width: 900px) {
	.wp-block-post-template.nz-masonry,
	.wp-block-gallery.is-style-masonry {
		column-count: 2;
	}
}

@media (max-width: 640px) {
	.wp-block-post-template.nz-masonry,
	.wp-block-gallery.is-style-masonry {
		column-count: 1;
	}

	.nz-collections--cols-2,
	.nz-collections--cols-3,
	.nz-collections--cols-4,
	.nz-photos--cols-2,
	.nz-photos--cols-3,
	.nz-photos--cols-4 {
		grid-template-columns: 1fr;
	}
}
