/**
 * Project Codex - Frontend Styles
 * These are base styles. Dynamic overrides from settings are injected via <style> in wp_head.
 */

.project-codex-posts {
	box-sizing: border-box;
	max-width: var(--pc-container-maxw, 100%);
	background: var(--pc-container-bg, #ffffff);
	border: 1px solid var(--pc-container-border, #e5e5e5);
	padding: var(--pc-container-pad, 1.25rem);
	border-radius: var(--pc-container-radius, 6px);
	margin: 1.5rem 0;
}

.project-codex-posts .project-heading {
	font-size: var(--pc-heading-size, 1.35rem);
	font-weight: var(--pc-heading-weight, 600);
	font-family: var(--pc-heading-family, inherit);
	color: var(--pc-heading-color, #1a1a1a);
	margin: 0 0 var(--pc-heading-mb, 0.75rem) 0;
	line-height: 1.3;
}

.project-codex-posts .project-heading a {
	color: inherit;
	text-decoration: none;
}

.project-codex-posts .project-heading a:hover {
	text-decoration: underline;
}

.project-codex-posts .project-post-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.project-codex-posts .project-post-list li {
	font-size: var(--pc-list-size, 0.95rem);
	font-family: var(--pc-list-family, inherit);
	color: var(--pc-list-color, #333333);
	line-height: var(--pc-list-lh, 1.55);
	margin: 0 0 var(--pc-list-spacing, 0.35rem) 0;
	padding-left: 0.25rem;
}

.project-codex-posts .project-post-list li:last-child {
	margin-bottom: 0;
}

.project-codex-posts .project-post-list a {
	color: inherit;
	text-decoration: none;
}

.project-codex-posts .project-post-list a:hover {
	color: var(--pc-list-hover, #0066cc);
	text-decoration: underline;
}

.project-codex-posts .project-post-list .post-date {
	color: #888;
	font-size: 0.8em;
	margin-left: 0.5em;
	white-space: nowrap;
}

/* Projects list shortcode */
/* Base grid for [project_codex_list] - the shortcode now also outputs strong inline styles
   as a fallback for builders like Oxygen that may override or delay plugin CSS. */
.project-codex-list {
	display: grid;
	grid-template-columns: repeat(var(--pc-projects-cols, 3), 1fr);
	gap: var(--pc-projects-gap, 1rem);
}

/* Fix for when the shortcode is placed inside Oxygen Text / rich text elements
   that wrap the output in <p><strong> etc. "display:contents" makes the wrapper
   transparent so the .project-item divs become direct grid children. */
.project-codex-list strong,
.project-codex-list > strong,
.project-codex-list p,
.project-codex-list > p {
	display: contents !important;
	font-weight: inherit !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* Responsive overrides - use !important so they win over any inline styles.
   On mobile (<=640px) we force 1 project per row as requested. */
@media (max-width: 900px) {
	.project-codex-list {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 640px) {
	.project-codex-list {
		grid-template-columns: 1fr !important;
	}
}

.project-codex-list .project-item {
	background: var(--pc-container-bg, #fff);
	border: 1px solid var(--pc-container-border, #e5e5e5);
	border-radius: var(--pc-container-radius, 6px);
	padding: 0;
	overflow: hidden;
	transition: transform .1s ease, box-shadow .1s ease;
	display: flex;
	flex-direction: column;
	/* Safety for when parent wrappers use display:contents */
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
}

.project-codex-list .project-item:hover {
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.project-codex-list .project-image-link {
	display: block;
	width: 100%;
}

.project-codex-list .project-featured-image {
	width: 100%;
	height: auto;
	display: block;
}

.project-codex-list .project-title {
	font-size: var(--pc-projects-title-size, 1.1rem);
	font-weight: 600;
	color: var(--pc-projects-title-color, #1a1a1a);
	padding: 0.75rem 1rem 0.25rem;
	line-height: 1.3;
}

.project-codex-list .project-title a {
	color: inherit;
	text-decoration: none;
}

.project-codex-list .project-title a:hover {
	text-decoration: underline;
}

.project-codex-list .project-count {
	font-size: var(--pc-projects-count-size, 0.8rem);
	color: var(--pc-projects-count-color, #666666);
	padding: 0 1rem 0.5rem;
}

.project-codex-list .project-description {
	font-size: var(--pc-projects-desc-size, 0.85rem);
	color: var(--pc-projects-desc-color, #555);
	padding: 0 1rem 0.9rem;
	line-height: var(--pc-projects-desc-lh, 1.45);
}

.project-codex-list .project-description p {
	margin: 0 0 0.5em;
	color: inherit;
	font-size: inherit;
	line-height: inherit;
}

/* When no image is present, give the title some top padding */
.project-codex-list .project-item .project-title:first-child {
	padding-top: 0.9rem;
}

.project-codex-empty {
	font-style: italic;
	color: #666;
}

/* Active / current article in the [project_codex] series list */
.project-codex-posts .project-post-list li.is-active {
	/* These are primarily controlled via dynamic CSS variables from settings */
	color: var(--pc-active-color, #0066cc);
	font-weight: var(--pc-active-weight, 600);
	background-color: var(--pc-active-bg, #f0f7ff);
	padding-left: 0.5rem;
	margin-left: -0.25rem;
	border-radius: 3px;
}

.project-codex-posts .project-post-list li.is-active .project-post-title,
.project-codex-posts .project-post-list li.is-active .post-date {
	color: inherit;
}

.project-codex-posts .project-post-list li.is-active .post-date {
	opacity: 0.85;
}

.project-codex-posts .project-post-list li.is-active a {
	color: inherit;
	text-decoration: none;
	cursor: default;
}

.project-codex-posts .project-post-list li.is-active a:hover {
	text-decoration: none;
	color: inherit;
}

/* Little "Current" badge for the active article */
.project-codex-posts .project-current-badge {
	display: inline-block;
	background: var(--pc-badge-bg, #0066cc);
	color: var(--pc-badge-color, #ffffff);
	font-size: var(--pc-badge-size, 0.65em);
	font-weight: 600;
	line-height: 1;
	padding: 0.15em 0.45em;
	border-radius: 3px;
	margin-left: 0.5em;
	vertical-align: middle;
	white-space: nowrap;
}
