/*
Theme Name: 5forests 2026 FSE
Theme URI: https://5forests.com
Author: URSA6
Author URI: https://ursa6.com
Description: Full Site Editing theme for 5forests, based on the URSA6 block starter. Local fonts, 5forests palette, and a lean pattern set for studio, work, services, and journal content.
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 8.1
Version: 0.1.2
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: 5forests2026-fse
Tags: full-site-editing, block-patterns, accessibility-ready, translation-ready, editor-style, featured-images, wide-blocks
*/

/* CSS Reset
---------------------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: inherit;
}

html {
	box-sizing: border-box;
	-moz-osx-font-smoothing: grayscale;
	-webkit-font-smoothing: antialiased;
	scrollbar-gutter: stable;
}

b,
strong {
	font-weight: var(--wp--custom--font-weight--semi-bold, 600);
}

ol,
ul {
	padding: 0;
}

ol:where(.wp-block-list),
ul:where(.wp-block-list) {
	padding-inline-start: var(--wp--preset--spacing--medium, 1.5rem);
}

div[class*="wp-block-"] figcaption {
	color: var(--wp--preset--color--contrast-soft, #3d3b3b);
	font-size: var(--wp--preset--font-size--x-small, 0.875em);
	margin-bottom: 0;
	margin-top: 0.5rem;
	text-align: center;
}

img,
figure {
	max-width: 100%;
	height: auto;
}

/* Standardize form styling
--------------------------------------------- */

input,
button,
textarea,
select {
	font: inherit;
}

input[type="button"],
input[type="email"],
input[type="search"],
input[type="submit"],
input[type="text"],
textarea {
	-webkit-appearance: none;
	appearance: none;
}

input:not([type="submit"]):not([type="radio"]),
select,
textarea,
.wp-block-post-comments-form input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.wp-block-post-comments-form textarea {
	color: var(--wp--preset--color--dk-1, #000);
	border-radius: 0;
	border: solid 1px var(--wp--preset--color--dk-1, #000);
	padding: 0.75em 1.2em;
	font-size: 0.9rem;
	background-color: var(--wp--preset--color--base, #fff);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
	outline-color: var(--wp--preset--color--dk-1, #000);
	outline-offset: 1px;
}

input[type="checkbox"],
input[type="image"],
input[type="radio"] {
	width: auto;
}

select {
	-webkit-appearance: none;
	appearance: none;
	background: var(--wp--preset--color--base, #fff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat;
	background-size: 16px;
	background-position: calc(100% - 12px) 50%;
	padding-right: 2.2em;
}

label {
	width: 100%;
	display: block;
}

::placeholder {
	color: var(--wp--preset--color--contrast-soft, #3d3b3b);
	opacity: 0.7;
}

/* Helper styles
---------------------------------------------------------------------------- */

.wp-site-blocks > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

.has-ursa6-transparent-header .wp-site-blocks > * {
	margin-block-start: 0;
}

a.more-link {
	display: inline;
}

*:not(.wp-block-code) > code {
	background-color: var(--wp--preset--color--lt-3, #f7f2f2);
	padding: 3px 5px;
	position: relative;
	font-size: var(--wp--preset--font-size--x-small, 0.875em);
}

.single .post-meta {
	align-items: center;
}

.single .post-meta > * + *::before {
	content: "·";
	margin-inline-end: 0.75rem;
	opacity: 0.65;
}

.single .wp-block-group:has(> .post-meta:empty) {
	display: none;
}

.wp-block-group:empty:has(+ .comment-respond) {
	display: none;
}

/* Sticky header — desktop adds admin bar offset; mobile uses top: 0. */

body:not(.wp-admin) header:has(> .is-position-sticky:not(.ursa6-header-transparent)) {
	position: sticky;
	top: calc(0px + var(--wp-admin--admin-bar--height, 0px));
	z-index: 100;
}

/* Mobile header offset is printed by Breakpoints from settings.viewport.tablet. */

.wp-block-site-logo .custom-logo-link {
	width: 100%;
}

/* Announcement bar (ACF options). */
.announcement {
	background-color: var(--wp--preset--color--dk-1);
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--x-small);
	padding: 0.5em var(--wp--preset--spacing--medium);
	text-align: center;
}

.announcement a {
	color: inherit;
}

/* Rank Math breadcrumbs. */
.rank-math-breadcrumb {
	font-size: var(--wp--preset--font-size--x-small);
	margin-bottom: var(--wp--preset--spacing--small);
}

.rank-math-breadcrumb ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em;
	list-style: none;
	margin: 0;
	padding: 0;
}

.rank-math-breadcrumb .separator {
	opacity: 0.55;
}

/* Footer reveal: the footer is pinned behind the page and uncovered on scroll. */
.wp-site-blocks > footer.wp-block-template-part {
	bottom: 0;
	margin-block-start: 0;
	position: sticky;
	z-index: 0;
}

:where(.wp-site-blocks > header) {
	position: relative;
	z-index: 2;
}

:where(.wp-site-blocks > main) {
	background-color: var(--wp--preset--color--base);
	position: relative;
	z-index: 1;
}

.wp-site-blocks > main[style*="margin-top:var(--wp--preset--spacing--3-x-large)"] {
	margin-top: 0 !important;
	padding-top: var(--wp--preset--spacing--3-x-large);
}

.wp-site-blocks > main:has(.entry-content > .alignfull:last-child) {
	padding-bottom: 0 !important;
}

.wp-site-blocks > main[style*="margin-bottom:var(--wp--preset--spacing--3-x-large)"] {
	margin-bottom: 0 !important;
	padding-bottom: var(--wp--preset--spacing--3-x-large);
}

.footer-reveal {
	margin-block-start: 0;
}

.footer-reveal__footer {
	background: var(--wp--preset--color--dk-2);
	box-sizing: border-box;
	color: var(--wp--preset--color--lt-2);
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100svh;
	justify-content: space-between;
	margin-block-start: 0;
	padding: 3rem var(--wp--preset--spacing--medium) 2.5rem;
}

.footer-reveal__footer > * {
	margin-block: 0;
	width: 100%;
}

.footer-reveal__offices {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 2.5rem;
	justify-content: center;
}

.footer-reveal__offices > * {
	margin: 0;
}

.office-times {
	display: grid;
	gap: 2rem;
	grid-template-columns: repeat(4, 1fr);
	overflow: clip;
}

.footer-reveal .office-time {
	border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent);
	padding-top: 1.25rem;
}

.footer-reveal .office-time p {
	margin: 0;
}

.office-time__place {
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.7;
}

.footer-reveal .office-time__time {
	font-size: var(--wp--preset--font-size--4-x-large);
	line-height: 1.2;
	padding-block: 0.5rem;
}

.office-time__email {
	font-size: var(--wp--preset--font-size--small);
}

.office-time__email a {
	color: inherit;
}

.footer-reveal .office-times,
.footer-reveal .office-times p,
.footer-reveal .office-times time,
.footer-reveal .office-times a {
	color: var(--wp--preset--color--lt-2) !important;
}

.footer-reveal__footer h2,
.footer-reveal__footer a {
	color: inherit;
}

.footer-reveal__legal {
	align-items: center;
	gap: 1.5rem;
}

.footer-reveal__legal p {
	margin: 0;
}

.footer-reveal__legal figure {
	flex-shrink: 0;
	margin: 0;
}

.footer-reveal__legal img {
	display: block;
}

.footer-reveal__links {
	gap: 1.5rem;
	opacity: 0.75;
}

.footer-reveal__links .wp-block-navigation__container {
	gap: 1rem;
}

/* Footer wrap at tablet is printed by Breakpoints from settings.viewport.tablet. */

@media (max-height: 620px) {
	.wp-site-blocks > footer.wp-block-template-part {
		position: relative;
	}

	.footer-reveal__footer {
		height: auto;
	}
}

/*
 * Work Query grids: pin featured images to the bottom of each row so
 * empty or wrapping subtitles do not stagger the photos.
 */
.wp-block-post-template.is-layout-grid > .wp-block-post:has(.wp-block-post-featured-image) {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.wp-block-post-template.is-layout-grid > .wp-block-post > .wp-block-post-featured-image,
.wp-block-post-template.is-layout-grid > .wp-block-post > .wp-block-group:has(.wp-block-post-featured-image) {
	margin-top: auto;
}

/* Work grid on Query Loop post templates (archive / work listings). */
.wp-block-post-template.is-style-work-grid {
	display: grid;
	gap: 1em;
	list-style: none;
	margin: 0;
	padding: 0;
}

.wp-block-post-template.is-style-work-grid .wp-block-post-featured-image {
	aspect-ratio: 16 / 9;
	margin: 0;
}

.wp-block-post-template.is-style-work-grid .wp-block-post-featured-image img {
	height: 100%;
	object-fit: cover;
	width: 100%;
}

@media (min-width: 460px) {
	.wp-block-post-template.is-style-work-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Table
--------------------------------------------- */

.wp-block-table table {
	background: var(--wp--preset--color--base, #fff);
	border: solid 1px var(--wp--preset--color--border, #d9d4d4);
	font-size: var(--wp--preset--font-size--x-small, 0.875em);
	overflow: hidden;
}

.wp-block-table.is-style-stripes {
	border-bottom: none;
}

.wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background-color: var(--wp--preset--color--lt-2, #faf7f7);
}

.wp-block-table td,
.wp-block-table th,
.wp-block-table thead {
	border: none;
	border-bottom: solid 1px var(--wp--preset--color--border, #d9d4d4);
}

.wp-block-table th,
.wp-block-table tfoot {
	text-align: left;
	background-color: var(--wp--preset--color--lt-2, #faf7f7);
}

.wp-block-table td,
.wp-block-table th {
	padding: 0.8em 1em;
}

/*
 * Project details: hide Region / Website rows when those values are empty.
 * Front end only — the site editor still shows the rows so they stay editable.
 * Empty post-terms outputs no markup. An empty ACF URL leaves href blank.
 */
body:not(.editor-styles-wrapper) .project-details__row--region:not(:has(.wp-block-post-terms)),
body:not(.editor-styles-wrapper) .project-details__row--region:has(.wp-block-post-terms:empty) {
	display: none;
}

body:not(.editor-styles-wrapper) .project-details__row--website:not(:has(a[href]:not([href=""]):not([href="#"]))) {
	display: none;
}

body:not(.editor-styles-wrapper) .project-details__row--services:not(:has(.services)) {
	display: none;
}
