/*
Theme Name: CIATR Custom Theme
Theme URI: https://github.com/ebois-inc/ciatrmagazine
Author: CIATR Team
Author URI: https://github.com/ebois-inc
Description: Custom WordPress theme for CIATR Magazine based on Twenty Twenty-Five. Clean and simple design with enhanced post metadata display capabilities.
Requires at least: 6.7
Tested up to: 6.8
Requires PHP: 7.2
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ciatr-custom
Tags: one-column, custom-colors, custom-menu, custom-logo, editor-style, featured-images, full-site-editing, block-patterns, rtl-language-support, sticky-post, threaded-comments, translation-ready, wide-blocks, block-styles, style-variations, accessibility-ready, blog, portfolio, news
*/

/*
 * Link styles
 * https://github.com/WordPress/gutenberg/issues/42319
 */

/*
 * CIATR Custom Theme Styles
 * Header with background image and responsive design
 */

/* Header with background image */
.ciatr-header-with-bg {
	min-height: 300px;
	position: relative;
}

/* Header container responsive behavior */
.ciatr-header-container {
	max-width: 1080px;
	margin: 0 auto;
}

/* Remove top margin from main content */
main.wp-block-group {
	margin-top: 0 !important;
}

/* Title content styling */
.ciatr-title-content {
	background: none !important;
	box-shadow: none !important;
}

.ciatr-title-content h1,
.ciatr-title-content p {
	display: inline-block;
	vertical-align: baseline;
}

.ciatr-header-content {
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ciatr-title-content {
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ciatr-magazine-title {
	text-shadow: none;
	letter-spacing: 0.05em;
}

/* PC styles (768px and above) */
@media (min-width: 768px) {
	.ciatr-header-with-bg {
		min-height: 400px;
	}

	.ciatr-magazine-title {
		font-size: 2.5rem !important;
	}

	.ciatr-header-content {
		padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40) !important;
	}

	.ciatr-title-content {
		padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40) 0 0 !important;
	}

	.ciatr-title-content p {
		font-size: 1.4rem !important;
		margin: 0 !important;
	}
}

/* Tablet styles (481px to 767px) */
@media (min-width: 481px) and (max-width: 767px) {
	.ciatr-header-with-bg {
		min-height: 200px;
	}

	.ciatr-header-container {
		max-width: 100%;
		margin: 0;
		padding: 0 var(--wp--preset--spacing--30);
	}

	.ciatr-magazine-title {
		font-size: 1.8rem !important;
	}

	.ciatr-header-content {
		padding: var(--wp--preset--spacing--25) var(--wp--preset--spacing--30) !important;
	}

	.ciatr-title-content {
		padding: var(--wp--preset--spacing--25) var(--wp--preset--spacing--30) 0 0 !important;
	}
}

/* Mobile styles (480px and below) */
@media (max-width: 480px) {
	.ciatr-header-with-bg {
		min-height: 150px;
		padding-top: var(--wp--preset--spacing--20) !important;
		padding-bottom: var(--wp--preset--spacing--20) !important;
	}

	.ciatr-header-container {
		max-width: 100%;
		margin: 0;
		padding: 0 var(--wp--preset--spacing--20);
	}

	.ciatr-magazine-title {
		font-size: 1.5rem !important;
	}

	.ciatr-header-content {
		padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--20) !important;
		flex-direction: column !important;
		align-items: center !important;
		text-align: center !important;
	}

	.ciatr-title-content {
		padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--20) 0 0 !important;
	}

	.ciatr-header-content .wp-block-group {
		margin-top: var(--wp--preset--spacing--10);
	}
}

/* Background image fallback */
.ciatr-header-with-bg {
	background-color: #ffffff;
}

/* Ensure text is readable over background */
.ciatr-header-content .wp-block-heading,
.ciatr-header-content .wp-block-navigation {
	position: relative;
	z-index: 2;
}
a {
	text-decoration-thickness: 1px !important;
	text-underline-offset: .1em;
}

/* Hide empty title blocks */
.wp-block-group:empty {
	display: none !important;
}

/* Focus styles */
:where(.wp-site-blocks *:focus) {
	outline-width: 2px;
	outline-style: solid;
}

/* Increase the bottom margin on submenus, so that the outline is visible. */
.wp-block-navigation .wp-block-navigation-submenu .wp-block-navigation-item:not(:last-child) {
	margin-bottom: 3px;
}

/* Increase the outline offset on the parent menu items, so that the outline does not touch the text. */
.wp-block-navigation .wp-block-navigation-item .wp-block-navigation-item__content {
	outline-offset: 4px;
}

/* Remove outline offset from the submenus, otherwise the outline is visible outside the submenu container. */
.wp-block-navigation .wp-block-navigation-item ul.wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	outline-offset: 0;
}

/*
 * Progressive enhancement to reduce widows and orphans
 * https://github.com/WordPress/gutenberg/issues/55190
 */
h1, h2, h3, h4, h5, h6, blockquote, caption, figcaption, p {
	text-wrap: pretty;
}

/*
 * Change the position of the more block on the front, by making it a block level element.
 * https://github.com/WordPress/gutenberg/issues/65934
*/
.more-link {
	display: block;
}

/* Fix overlay width overflow issue and center alignment for post templates */
.wp-block-query .wp-block-post-template {
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	gap: 2.5rem !important;
}

.wp-block-query .wp-block-group[style*="position:relative"] {
	overflow: hidden !important;
	width: 100% !important;
	max-width: 100% !important;
	position: relative !important;
}

.wp-block-query .wp-block-group[style*="position:absolute"][style*="bottom:0"] {
    left: 0 !important;
    right: 0 !important;
    box-sizing: border-box !important;
}

/* Match overlay width to actual thumbnail image width */
.wp-block-post-featured-image { position: relative; }
.wp-block-post-featured-image a,
.wp-block-post-featured-image img { display: block; }
.wp-block-post-featured-image + .wp-block-group[style*="position:absolute"] {
    width: auto !important;
    inset-inline: 0 !important; /* respect left/right */
    /* Round bottom corners to match the thumbnail */
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Mobile – apply same fix as PC to prevent overflow */
@media (max-width: 480px) {
    /* Ensure mobile uses same overlay width logic as PC */
    .wp-block-post-featured-image + .wp-block-group[style*="position:absolute"] {
        width: 86% !important;
        inset-inline: 0 !important;
        box-sizing: border-box !important;
        /* Round bottom corners to match the thumbnail */
        border-bottom-left-radius: 8px !important;
        border-bottom-right-radius: 8px !important;
    }
    
    /* Additional selector to ensure all overlays get rounded corners */
    .wp-block-query .wp-block-group[style*="position:absolute"][style*="bottom:0"] {
        border-bottom-left-radius: 8px !important;
        border-bottom-right-radius: 8px !important;
    }
}

/* Ensure the image container constrains the overlay */
.wp-block-query .wp-block-post-featured-image {
	display: block !important;
	width: 100% !important;
}

.wp-block-query .wp-block-post-featured-image img {
	width: 100% !important;
	height: auto !important;
	display: block !important;
}

/* Category list styling in footer */
.ciatr-category-list {
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.ciatr-category-list li {
	margin-bottom: var(--wp--preset--spacing--10) !important;
	padding: 0 !important;
}

.ciatr-category-list a {
	text-decoration: none !important;
	color: var(--wp--preset--color--contrast) !important;
	font-size: var(--wp--preset--font-size--small) !important;
	transition: color 0.3s ease !important;
}

.ciatr-category-list a:hover {
	color: var(--wp--preset--color--primary) !important;
	text-decoration: underline !important;
}
