/*
Theme Name: Dark Modernist
Theme URI: https://phil.woodscorner.de
Author: philwoodscorner
Author URI: https://phil.woodscorner.de
Description: Modernist is a refined WordPress theme for writers, critics, and cultural thinkers who value structure, clarity, and bold design. With its asymmetric layouts and typographic confidence, Modernist offers a clean yet expressive space for long-form essays, media critique, and personal reflections. Modernist is ideal for blogs, digital publications, and personal writing portfolios where tone and aesthetics align with sharp thinking.
Requires at least: 6.7
Tested up to: 6.7
Requires PHP: 7.2
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: modernist
Tags: blog, block-styles, two-columns, four-columns, left-sidebar, wide-blocks, featured-images, full-site-editing, rtl-language-support, sticky-post, style-variations, threaded-comments, translation-ready
*/

/* U001 Font Face Declarations - Paths will be replaced by PHP */

/* Ensure U001 font is applied */
body,
html,
.wp-site-blocks,
.wp-block-group,
.wp-block-post-content,
p,
h1, h2, h3, h4, h5, h6 {
	font-family: 'U001', sans-serif;
}

/* Progresive enhancement to reduce widows and orphans.
/* https://github.com/WordPress/gutenberg/issues/55190
*/

h1, h2, h3, h4, h5, h6, blockquote, caption, figcaption {
    text-wrap: balance;
}
p {
    text-wrap: pretty;
}

/*
 * Control the hover stylings of outline block style.
 * Unnecessary once block styles are configurable via theme.json
 * https://github.com/WordPress/gutenberg/issues/42794
 */
.wp-block-button.is-style-outline>.wp-block-button__link:not(.has-background):hover {
	background-color: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--base);
	border-color: var(--wp--preset--color--secondary);
}

/*
 * Link styles
 * https://github.com/WordPress/gutenberg/issues/42319
 */
a {
	text-decoration-thickness: .0625em !important;
	text-underline-offset: .15em;
}

/* Convert all text to lowercase */
body,
html,
.wp-site-blocks,
* {
	text-transform: lowercase !important;
}

/* Make numbers smaller - numbers wrapped in .number-small will be 1 fontsize smaller */
.number-small {
	font-size: 0.9em;
	display: inline;
}

/* Site title orientation - read from bottom to top */
.wp-block-site-title,
.wp-block-site-title a,
.wp-block-site-title *,
.wp-block-site-title p,
.wp-block-site-title h1,
.wp-block-site-title h2,
.wp-block-site-title h3,
.wp-block-site-title h4,
.wp-block-site-title h5,
.wp-block-site-title h6 {
	writing-mode: tb-rl !important;
	transform: rotate(93deg) !important;
	transform-origin: center center !important;
	display: inline-block !important;
}

/* Reduce space between title and subtitle */
.wp-block-group:has(.wp-block-site-title) {
	gap: 0.1rem !important;
}

.wp-block-site-title + .wp-block-site-tagline,
.wp-block-site-title ~ .wp-block-site-tagline {
	margin-top: 0.1rem !important;
	margin-bottom: 0 !important;
}

/* Collapsible comment form */
.wp-block-post-comments-form {
	display: none;
}

.wp-block-post-comments-form.is-expanded {
	display: block;
}

.comment-form-toggle {
	cursor: pointer;
	text-decoration: underline;
}

.comment-form-toggle:hover {
	text-decoration: none;
}

/* Burger menu width */
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-open button,
.wp-block-navigation__responsive-container-open svg,
.wp-block-navigation__responsive-container-open .wp-block-navigation__responsive-container-icon,
.wp-block-navigation button[aria-label*="menu"],
.wp-block-navigation button[aria-label*="Menu"],
.wp-block-navigation .wp-block-navigation__responsive-container-icon svg,
.wp-block-navigation__responsive-container-icon,
.wp-block-navigation__responsive-container-icon svg,
.wp-block-navigation__responsive-container-icon button,
button.wp-block-navigation__responsive-container-open,
.wp-block-navigation button[type="button"],
.wp-block-navigation .wp-block-navigation__responsive-container-icon,
.wp-block-navigation button,
.wp-block-navigation svg {
	width: 35px !important;
	min-width: 35px !important;
	max-width: 35px !important;
}

.wp-block-navigation__responsive-container-icon,
.wp-block-navigation__responsive-container-icon button,
.wp-block-navigation__responsive-container-icon svg {
	width: 35px !important;
	height: 35px !important;
	min-width: 35px !important;
	min-height: 35px !important;
	max-width: 35px !important;
	max-height: 35px !important;
}

/* Reduce left padding from has-global-padding class on main element - half the default */
main.wp-block-group.has-global-padding,
main.has-global-padding {
	padding-left: calc(var(--wp--preset--spacing--50) / 2) !important;
}

/* Ensure header is always clear of content on mobile */
header.wp-block-template-part {
	position: relative !important;
	z-index: 100 !important;
	background-color: var(--wp--preset--color--base, #ffffff) !important;
	overflow: visible !important;
}

/* Add safe space between header and content on big screens */
@media (min-width: 783px) {
	/* Ensure header stays on left, not centered */
	.wp-block-column:has(header.wp-block-template-part),
	.wp-block-column:has(.wp-block-template-part[area="header"]) {
		display: flex !important;
		justify-content: flex-start !important;
		align-items: flex-start !important;
	}
	
	header.wp-block-template-part,
	header.wp-block-template-part .wp-block-group {
		width: 100% !important;
		max-width: 100% !important;
	}
	
	/* Add gap between header column and content column - reduced spacing */
	.wp-block-columns.alignwide:has(.wp-block-template-part[area="header"]),
	.wp-block-columns:has(header.wp-block-template-part) {
		gap: 1.5rem !important;
		column-gap: 1.5rem !important;
	}
	
	/* Add padding to content column to create safe space - reduced */
	.wp-block-column:has(.wp-block-template-part[area="header"]) + .wp-block-column {
		padding-left: 0.5rem !important;
	}
}

/* Header wrapper and logo stay together as one group */
header.wp-block-template-part .wp-block-group,
header.wp-block-template-part .wp-block-group .wp-block-group {
	position: relative !important;
	z-index: 100 !important;
}

/* Logo is part of the header group, not separate */
.wp-block-site-logo,
.wp-block-site-logo img,
.wp-block-site-logo a {
	position: relative !important;
	z-index: 100 !important;
}

/* Logo size on smallest screens */
@media (max-width: 782px) {
	.wp-block-site-logo,
	.wp-block-site-logo img {
		width: 60px !important;
		max-width: 60px !important;
		height: 60px !important;
		max-height: 60px !important;
		min-width: 60px !important;
		object-fit: contain !important;
	}
	
	.wp-block-site-logo a {
		display: block !important;
		width: 60px !important;
		max-width: 60px !important;
		height: 60px !important;
		max-height: 60px !important;
	}
}

/* Prevent content from overlapping header on mobile */
@media (max-width: 782px) {
	header.wp-block-template-part {
		position: relative !important;
		z-index: 100 !important;
		margin-bottom: 0 !important;
		padding-bottom: 5px !important;
	}
	
	/* Ensure header wrapper and logo stay together */
	header.wp-block-template-part .wp-block-group,
	header.wp-block-template-part .wp-block-group .wp-block-group {
		position: relative !important;
		z-index: 100 !important;
	}
	
	.wp-block-site-logo,
	.wp-block-site-logo img,
	.wp-block-site-logo a {
		position: relative !important;
		z-index: 100 !important;
		display: block !important;
		visibility: visible !important;
		opacity: 1 !important;
	}
	
	/* Prevent content from moving behind header - create clear boundary */
	.wp-site-blocks > main,
	.wp-site-blocks > .wp-block-group:not(header),
	.wp-site-blocks > article {
		position: relative !important;
		z-index: 1 !important;
		margin-top: 0 !important;
		margin-left: 0 !important;
		padding-left: 1.5rem !important;
		border-left: none !important;
	}
	
	/* Ensure columns layout respects the boundary */
	.wp-block-columns:has(.wp-block-template-part[area="header"]),
	.wp-block-columns.alignwide:has(.wp-block-template-part[area="header"]),
	.wp-block-columns.is-not-stacked-on-mobile:has(.wp-block-template-part[area="header"]) {
		gap: 0 !important;
		margin-left: 0 !important;
		padding-left: 0 !important;
	}
	
	/* Header column - absolutely no space to the left */
	.wp-block-column:has(.wp-block-template-part[area="header"]),
	.wp-block-column:has(header.wp-block-template-part),
	.wp-block-column[style*="flex-basis:7.5%"] {
		padding-left: 0 !important;
		margin-left: 0 !important;
		flex-basis: auto !important;
	}
	
	/* Remove any padding from header template part itself */
	header.wp-block-template-part,
	header.wp-block-template-part .wp-block-group,
	header.wp-block-template-part .wp-block-group.alignwide,
	header.wp-block-template-part .full-height {
		padding-left: 0 !important;
		margin-left: 0 !important;
	}
	
	/* Remove padding from logo container and all parent elements */
	header.wp-block-template-part .wp-block-site-logo,
	header.wp-block-template-part .wp-block-site-logo * {
		margin-left: 0 !important;
		padding-left: 0 !important;
	}
	
	/* Remove any left spacing from main wrapper */
	main.wp-block-group:has(.wp-block-columns:has(.wp-block-template-part[area="header"])) {
		padding-left: 0 !important;
		margin-left: 0 !important;
	}
	
	/* Content column must have clear left boundary - 1.5rem spacing */
	.wp-block-column:has(.wp-block-template-part[area="header"]) + .wp-block-column,
	.wp-block-column:has(header.wp-block-template-part) + .wp-block-column {
		padding-left: 1.5rem !important;
		margin-left: 0 !important;
		min-width: 0 !important;
	}
	
	/* Remove any padding/margin from main container */
	.wp-site-blocks {
		padding-left: 0 !important;
		margin-left: 0 !important;
	}
	
	/* Reduce left padding from has-global-padding class on main element */
	main.wp-block-group.has-global-padding,
	main.has-global-padding {
		padding-left: calc(var(--wp--preset--spacing--50) / 2) !important;
	}
	
	/* Ensure rotated elements in header don't overflow */
	header.wp-block-template-part .wp-block-site-title,
	header.wp-block-template-part .wp-block-site-tagline,
	header.wp-block-template-part .modernist-footer-links {
		overflow: visible !important;
		position: relative !important;
	}
}

/* Impressum/Datenschutz links in navigation menu - smaller than main menu */
.modernist-menu-footer-links {
	margin-top: var(--wp--preset--spacing--40) !important;
	padding-top: var(--wp--preset--spacing--20) !important;
	border-top: 1px solid rgba(0,0,0,0.1) !important;
}

.modernist-menu-footer-links .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--small) !important;
}

.modernist-menu-footer-links a {
	font-size: var(--wp--preset--font-size--small) !important;
	text-decoration: none !important;
}

.modernist-cookie-link-wrapper {
	line-height: 1.2 !important;
	margin-top: -0.2em !important;
	display: block !important;
}

/* Align burger, subtitle, and footer links in one fixed line on the right */
.modernist-right-aligned {
	display: flex !important;
	flex-direction: row !important;
	justify-content: flex-end !important;
	align-items: center !important;
	gap: 1rem !important;
	flex-wrap: nowrap !important;
	width: 100% !important;
	position: relative !important;
}

/* Keep navigation (burger) in the right-aligned group - always on far right */
.modernist-right-aligned .wp-block-navigation {
	margin: 0 !important;
	order: 3 !important;
	flex-shrink: 0 !important;
	flex-grow: 0 !important;
	align-self: center !important;
}

/* Keep subtitle in the right-aligned group - between burger and links */
.modernist-right-aligned .wp-block-site-tagline {
	order: 2 !important;
	margin: 0 !important;
	flex-shrink: 0 !important;
	flex-grow: 0 !important;
	align-self: center !important;
}

/* Ensure line stays completely stable on all screen sizes */
@media (min-width: 783px) {
	.modernist-right-aligned {
		justify-content: flex-end !important;
		align-items: center !important;
		gap: 1rem !important;
	}
	
	.modernist-right-aligned .wp-block-navigation,
	.modernist-right-aligned .wp-block-site-tagline {
		margin: 0 !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		flex-shrink: 0 !important;
		flex-grow: 0 !important;
		align-self: center !important;
	}
}

@media (max-width: 782px) {
	.modernist-right-aligned {
		justify-content: flex-end !important;
		align-items: center !important;
		gap: 1rem !important;
	}
	
	.modernist-right-aligned .wp-block-navigation,
	.modernist-right-aligned .wp-block-site-tagline {
		margin: 0 !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		flex-shrink: 0 !important;
		flex-grow: 0 !important;
		align-self: center !important;
	}
}

.modernist-footer-links p {
	margin: 0 !important;
	display: inline !important;
	white-space: nowrap !important;
}

.modernist-footer-links a {
	text-decoration: none !important;
	display: inline !important;
	white-space: nowrap !important;
}

/* Prevent numbers.js from making numbers smaller in location only */
.modernist-location .number-small {
	font-size: inherit !important;
}

/* Comments title size */
.wp-block-comments-title,
.wp-block-comments-title h1,
.wp-block-comments-title h2,
.wp-block-comments-title h3,
.wp-block-comments-title h4,
.wp-block-comments-title h5,
.wp-block-comments-title h6 {
	font-size: var(--wp--preset--font-size--large) !important;
}
