/*
Theme Name: Centomila Theme
Theme URI: https://centomila.com
Author: centomila
Author URI: https://centomila.com
Description: A minimal block theme for the Centomila music project. Features custom templates for Releases, Tracks, Social links, Images, and Software sections.
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 8.0
Version: 1.16.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: centomila-theme
Tags: one-column, custom-colors, custom-menu, custom-logo, editor-style, featured-images, full-site-editing, block-patterns, wide-blocks, block-styles, translation-ready
*/

/* ─── Global: No Border Radius ─── */

.wp-site-blocks img,
.wp-site-blocks .wp-block-post-featured-image img,
.wp-site-blocks .wp-block-image img,
.wp-site-blocks .wp-block-cover img,
.wp-site-blocks figure img {
	border-radius: 0;
}

/* ─── Body: Subtle dark gradient ─── */
body {
	background: linear-gradient(160deg, #1a1a1a 0%, #0f0f0f 40%, #222222 100%);
	background-attachment: fixed;
}

/* ─── Release single: Blurred hero behind navbar ─── */
.cm-release-hero-blur {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 60vh;
	background-size: cover;
	background-position: center;
	filter: blur(60px) saturate(1.4) brightness(0.5);
	-webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
	mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
	z-index: -1;
	pointer-events: none;
}

/* ─── Sticky Header — Frosted Glass ─── */

/* Smooth scroll with offset for sticky header */
html {
	scroll-behavior: smooth;
	scroll-padding-top: 5rem;
}

/* Target the WP template-part <header> wrapper so sticky has a tall parent */
header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 9999;
}

.centomila-header {
	background-color: rgba(255, 255, 255, 0.60);
	backdrop-filter: blur(20px) saturate(1.3);
	-webkit-backdrop-filter: blur(20px) saturate(1.3);
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.centomila-header:hover {
	backdrop-filter: blur(24px) saturate(1.5);
	-webkit-backdrop-filter: blur(24px) saturate(1.5);
}

/* Logo sizing — faithful to original (height 2rem, min-width 8rem) */
.centomila-header .centomila-logo {
	margin-bottom: 0;
}

.centomila-header .centomila-logo img {
	min-width: 8rem;
	height: 2rem;
	width: auto;
	margin-top: -0.3rem;
}

/* Dark text on white frosted header.
 * Specificity (0,4,0) beats WP navigation block's doubled-class trick (0,3,0). */
.centomila-header .wp-block-navigation.centomila-nav a,
.centomila-header .wp-block-navigation.centomila-nav .wp-block-navigation-item__content {
	color: #3d3d3d;
	position: relative;
	transition: color 0.2s ease;
}

/* Sliding underline on hover */
.centomila-header .wp-block-navigation.centomila-nav .wp-block-navigation-item__content::after {
	content: '';
	position: absolute;
	bottom: -3px;
	left: 0;
	width: 0;
	height: 2px;
	background-color: #000;
	transition: width 0.25s ease;
}

.centomila-header .wp-block-navigation.centomila-nav a:hover,
.centomila-header .wp-block-navigation.centomila-nav .wp-block-navigation-item__content:hover {
	color: #000;
}

.centomila-header .wp-block-navigation.centomila-nav .wp-block-navigation-item__content:hover::after {
	width: 100%;
}

/* ─── Typography — faithful to Hugo/Ananke original ─── */

/* Paragraph / body text */
.wp-site-blocks p,
.wp-site-blocks li {
	transition: color 0.15s ease-in;
}

/* ─── Sticky footer: push footer to bottom when content is short ─── */

.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
}

.wp-site-blocks > main {
	flex: 1;
}

/* ─── Footer ─── */

footer.wp-block-template-part {
	margin-top: var(--wp--preset--spacing--60);
}

/* Single CPT pages end with a section that already has padding-bottom: spacing-60
   from the section divider rule — removing margin-top prevents double-spacing. */
.single-cm_release footer.wp-block-template-part,
.single-cm_portfolio footer.wp-block-template-part,
.single-cm_software footer.wp-block-template-part,
.single-cm_track footer.wp-block-template-part {
	margin-top: 0;
}

/* Archive pages: center h1 between navbar and grid */
main > .wp-block-query {
	margin-block-start: var(--wp--preset--spacing--60);
}

.centomila-footer .wp-block-social-links a {
	color: #BABABA;
	fill: currentColor;
	transition: opacity 0.15s ease-in;
}

.centomila-footer .wp-block-social-links a:hover {
	opacity: 0.6;
}

/* Social links rendered via [centomila_socials] shortcode */
.centomila-social-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.75rem;
}

.centomila-social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #999;
	fill: currentColor;
	transition: color 0.15s ease-in;
	padding: 0.5rem;
}

.centomila-social-link:hover {
	color: #f4f4f4;
}

.centomila-social-link svg {
	width: 32px;
	height: 32px;
	fill: currentColor;
}

/* ─── Release Single Page ─── */

/* Sticky cover: image stays fixed while the right column scrolls.
 * The column stretches to match the right column height (default flex behavior).
 * position: relative makes the column the containing block, so the sticky
 * image is bounded by the column bottom — it stays fixed until the last line
 * of the description scrolls past. */
.single-cm_release .cm-release-cover-col,
.single-cm_software .cm-release-cover-col,
.single-cm_portfolio .cm-release-cover-col,
.single-cm_track .cm-release-cover-col {
	position: relative;
}

@media (min-width: 1024px) {
	.single-cm_release .cm-release-cover-col .cm-release-cover-sticky,
	.single-cm_software .cm-release-cover-col .cm-release-cover-sticky,
	.single-cm_portfolio .cm-release-cover-col .cm-release-cover-sticky,
	.single-cm_track .cm-release-cover-col .cm-release-cover-sticky {
		position: sticky;
		/* --cm-sticky-top is written by page-transitions.js as a custom property on
		 * this element, so it is only consumed here (inside the desktop media query)
		 * and never leaks into WP's position:relative context at smaller viewports */
		top: var(--cm-sticky-top, calc(2rem + 2 * var(--wp--preset--spacing--30) + var(--wp--preset--spacing--60)));
	}
}

/* Extra breathing room between tracklist and description block */
.cm-release-description {
	margin-block-start: var(--wp--preset--spacing--50);
}

/* Section headings (Description + Gallery across all single-CPT pages) */
.cm-release-description > .wp-block-heading,
.cm-software-description > .wp-block-heading,
.cm-portfolio-section-heading,
.cm-gallery-heading {
	font-size: clamp(1.25rem, 1rem + 1.5vw, 1.625rem);
	font-weight: 400;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #bbb;
	margin-bottom: var(--wp--preset--spacing--40);
}

/* Track list (plugin block) */
.cm-track-list {
	list-style: none;
	padding: 0;
	margin: 0 0 2rem;
	text-align: right;
}

.cm-track-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid rgba(244, 244, 244, 0.15);
	color: #999;
	transition: color 0.15s ease-in;
}

.cm-track-item:hover {
	color: #f4f4f4;
}

.cm-track-number {
	color: #666;
	font-size: 0.875rem;
	width: 1rem;
	text-align: right;
}

.cm-track-title {
	flex: 1;
	color: inherit;
	text-decoration: none;
	text-align: left;
}

.cm-track-title:hover {
	color: var(--wp--preset--color--accent-1);
}

.cm-track-duration {
	color: #666;
	font-size: 0.875rem;
	font-variant-numeric: tabular-nums;
}

.cm-track-artist {
	display: none;
}

/* Release subtitle ("DD Mon YYYY | Tracks: N") + track subtitle ("ARTIST · DURATION · YEAR") */
.cm-release-subtitle,
.cm-track-subtitle {
	text-align: left;
	font-weight: 100;
	font-size: 0.875rem;
	color: #999;
	margin: 0;
	letter-spacing: 0.3rem;
	text-transform: uppercase;
}

.cm-disc-header {
	font-weight: 700;
	padding: 0.75rem 0 0.25rem;
	color: #f4f4f4;
	text-transform: uppercase;
	letter-spacing: 0.1rem;
	font-size: 0.875rem;
	list-style: none;
}

/* Streaming links (plugin block) */
.cm-streaming-links {
	margin-top: var(--wp--preset--spacing--40);
}

.cm-links-heading {
	text-transform: uppercase;
	text-align: left;
	font-size: 1rem;
	letter-spacing: normal;
	margin-bottom: 0.5rem;
}

.cm-links-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem 0.875rem;
}

.cm-links-list li {
	white-space: nowrap;
}

.cm-links-list a {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	color: #999;
	text-decoration: none;
	letter-spacing: 0.05em;
	transition: color 0.15s ease-in;
}

.cm-link-icon {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	/* Optical correction: compensate for Gudea's asymmetric em-box
	 * (~1.6px dead space above cap-height vs ~3.2px below baseline) */
	transform: translateY(1px);
}

.cm-link-label {
	line-height: 1;
}

.cm-link-icon svg {
	display: block;
	width: 1rem;
	height: 1rem;
	fill: currentColor;
}

.cm-links-list a:hover {
	color: #f4f4f4;
}

/* Gallery — match wide size (same width as navbar/archive grids) */
.cm-release-gallery-section > .wp-block-heading,
.cm-software-gallery-section > .wp-block-heading,
.cm-portfolio-gallery-section > .wp-block-heading,
.cm-release-gallery,
.cm-software-gallery,
.cm-portfolio-gallery {
	max-width: var(--wp--style--global--wide-size, 1280px);
	margin-left: auto;
	margin-right: auto;
}

/* Flexbox gallery: centers incomplete rows */
.cm-release-gallery,
.cm-software-gallery,
.cm-portfolio-gallery {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4rem;
}

.cm-release-gallery-section:not(:has(.cm-release-gallery)),
.cm-release-gallery-section:has(.cm-release-gallery:empty),
.cm-release-gallery:empty {
	display: none;
}

/* Section dividers: base padding (inline padding removed from templates) */
.wp-block-group.alignfull[style*="border-top"],
.wp-block-group.alignwide[style*="border-top"] {
	padding-top: var(--wp--preset--spacing--60);
	padding-bottom: var(--wp--preset--spacing--60);
}

/* ─── Track Single Page ─── */

/* Cover: square, inherits the release art. Mirrors the release cover. */
.cm-track-cover {
	margin: 0;
	aspect-ratio: 1;
	overflow: hidden;
}

.cm-track-cover-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0;
}

/* Inherited cover links back to its release, revealing the title on hover */
.cm-track-cover-link {
	display: block;
	position: relative;
	line-height: 0;
}

.cm-track-cover-badge {
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	padding: 0.75rem 1rem;
	font-size: 0.75rem;
	line-height: 1.2;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #f4f4f4;
	background: linear-gradient(to top, rgba(10, 10, 10, 0.85), rgba(10, 10, 10, 0));
	opacity: 0;
	transition: opacity 0.2s ease-in;
}

.cm-track-cover-link:hover .cm-track-cover-badge,
.cm-track-cover-link:focus-visible .cm-track-cover-badge {
	opacity: 1;
}

/* Metadata panel — the centerpiece of the track page */
.cm-track-meta {
	margin: 0 0 var(--wp--preset--spacing--50);
	display: flex;
	flex-direction: column;
}

.cm-track-meta-row {
	display: grid;
	grid-template-columns: minmax(7rem, 30%) 1fr;
	gap: 0.75rem 1rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid rgba(244, 244, 244, 0.12);
}

.cm-track-meta-label {
	margin: 0;
	font-size: 0.75rem;
	font-weight: 400;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #777;
	align-self: center;
}

.cm-track-meta-value {
	margin: 0;
	color: #ccc;
	font-weight: 100;
}

.cm-track-meta-code {
	font-family: ui-monospace, "SFMono-Regular", "Menlo", monospace;
	font-size: 0.9em;
	letter-spacing: 0.04em;
	color: #e4e4e4;
}

.cm-track-meta-value a,
.cm-track-meta-link {
	color: var(--wp--preset--color--accent-1);
	text-decoration: none;
	transition: opacity 0.15s ease-in;
}

.cm-track-meta-value a:hover,
.cm-track-meta-link:hover {
	opacity: 0.7;
}

/* Lyrics panel */
.cm-track-lyrics-section {
	margin-block: var(--wp--preset--spacing--50);
}

.cm-track-lyrics-section > .wp-block-heading {
	font-size: clamp(1.25rem, 1rem + 1.5vw, 1.625rem);
	font-weight: 400;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #bbb;
	margin-bottom: var(--wp--preset--spacing--40);
}

.cm-track-lyrics {
	color: #bbb;
	font-weight: 100;
	line-height: 1.7;
}

.cm-track-lyrics p {
	margin-block: 0 1rem;
}

/* ─── Software Single Page ─── */

/* Single-page right-column titles */
.cm-release-header .wp-block-post-title {
	text-align: left;
}

.cm-software-header .wp-block-post-title {
	text-align: left;
}

/* Version badge — mirrors .cm-release-subtitle */
.cm-version-badge {
	text-align: left;
	font-weight: 100;
	font-size: 0.875rem;
	color: #999;
	margin: 0;
	letter-spacing: 0.3rem;
	text-transform: uppercase;
}

/* Requirements block */
.cm-software-requirements {
	margin-bottom: var(--wp--preset--spacing--40);
}

.cm-sw-requirements-list {
	list-style: none;
	padding: 0;
	margin: 0;
	text-align: left;
}

.cm-sw-requirements-list li {
	padding: 0.35rem 0;
	border-bottom: 1px solid rgba(244, 244, 244, 0.15);
	color: #999;
	transition: color 0.15s ease-in;
}

.cm-sw-requirements-list li:hover {
	color: #f4f4f4;
}

/* Shared heading for requirements/resources — mirrors .cm-links-heading */
.cm-sw-heading {
	text-transform: uppercase;
	text-align: left;
	font-size: 1rem;
	letter-spacing: normal;
	margin-bottom: 0.5rem;
}

/* Download links block */
.cm-software-downloads {
	margin-top: var(--wp--preset--spacing--40);
}

.cm-sw-downloads-list {
	list-style: none;
	padding: 0;
	margin: 0;
	text-align: left;
}

.cm-sw-downloads-list li {
	padding: 0.35rem 0;
	border-bottom: 1px solid rgba(244, 244, 244, 0.15);
}

.cm-sw-download-link {
	color: #999;
	text-decoration: underline;
	text-underline-offset: 3px;
	letter-spacing: 0.05em;
	padding: 0 0.25rem 0 0;
	transition: color 0.15s ease-in;
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}

.cm-sw-download-link:hover {
	color: #f4f4f4;
}

/* Auto-hide empty gallery/manual sections */
.cm-software-gallery-section:empty,
.cm-software-manual-section:not(:has(.cm-software-manual)),
.cm-portfolio-gallery-section:has(.cm-portfolio-gallery:empty),
.cm-portfolio-gallery:empty {
	display: none;
}

/* ─── Software Manual Section ─── */

.cm-software-manual {
	max-width: var(--wp--style--global--content-size, 720px);
	margin-left: auto;
	margin-right: auto;
}

.cm-software-manual h3,
.cm-software-manual h4,
.cm-software-manual h5 {
	margin-top: 2.5rem;
	margin-bottom: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.cm-software-manual h3 {
	font-size: 1.25rem;
	font-weight: 300;
}

.cm-software-manual h4 {
	font-size: 1.1rem;
	font-weight: 400;
}

.cm-software-manual h5 {
	font-size: 0.95rem;
	font-weight: 400;
	color: #bbb;
}

.cm-software-manual p {
	margin-bottom: 1rem;
	line-height: 1.8;
}

.cm-software-manual ul,
.cm-software-manual ol {
	margin-bottom: 1.5rem;
	padding-left: 1.5rem;
}

.cm-software-manual li {
	margin-bottom: 0.4rem;
	line-height: 1.7;
}

.cm-software-manual li ul {
	margin-top: 0.4rem;
	margin-bottom: 0.4rem;
}

/* Keyboard key styling */
.cm-software-manual kbd {
	display: inline-block;
	padding: 0.15em 0.5em;
	font-family: inherit;
	font-size: 0.85em;
	line-height: 1.4;
	color: #f4f4f4;
	background: #333;
	border: 1px solid #555;
	border-radius: 4px;
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
	white-space: nowrap;
	vertical-align: baseline;
}

/* Code blocks */
.cm-software-manual pre {
	background: #1a1a1a;
	border: 1px solid #333;
	border-radius: 6px;
	padding: 1.25rem 1.5rem;
	margin: 1.25rem 0;
	overflow-x: auto;
}

.cm-software-manual pre code {
	font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
	font-size: 0.85rem;
	line-height: 1.6;
	color: #e0e0e0;
	background: none;
	padding: 0;
	border: none;
}

.cm-software-manual code {
	font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
	font-size: 0.85em;
	padding: 0.15em 0.4em;
	background: #1a1a1a;
	border: 1px solid #333;
	border-radius: 3px;
	color: #e0e0e0;
}

/* Images */
.cm-software-manual figure.cm-manual-figure {
	margin: 2rem 0;
	text-align: center;
}

.cm-software-manual figure.cm-manual-figure img {
	max-width: 100%;
	height: auto;
	border-radius: 6px;
	border: 1px solid #333;
}

.cm-software-manual figure.cm-manual-image {
	margin: 1.5rem 0;
	text-align: center;
}

.cm-software-manual figure.cm-manual-image img {
	max-width: 100%;
	height: auto;
	border-radius: 6px;
	border: 1px solid #333;
	display: inline-block;
}

.cm-software-manual figure.cm-manual-figure figcaption {
	font-size: 0.8rem;
	color: #999;
	margin-top: 0.5rem;
	font-style: italic;
}

/* Tables */
.cm-software-manual table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.5rem 0;
}

.cm-software-manual th,
.cm-software-manual td {
	padding: 0.6rem 1rem;
	border: 1px solid #333;
	text-align: left;
}

.cm-software-manual th {
	background: #1a1a1a;
	font-weight: 600;
	text-transform: uppercase;
	font-size: 0.85rem;
	letter-spacing: 0.05em;
}

.cm-software-manual td {
	color: #ccc;
}

/* Table of contents */
.cm-software-manual .cm-manual-toc {
	background: #1a1a1a;
	border: 1px solid #333;
	border-radius: 6px;
	padding: 1.25rem 1.5rem;
	margin-bottom: 2.5rem;
}

.cm-software-manual .cm-manual-toc h4 {
	margin-top: 0;
	margin-bottom: 0.75rem;
	font-size: 1rem;
}

.cm-software-manual .cm-manual-toc ul {
	margin-bottom: 0;
	padding-left: 1.25rem;
}

.cm-software-manual .cm-manual-toc li {
	margin-bottom: 0.25rem;
}

.cm-software-manual .cm-manual-toc a {
	color: #999;
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: color 0.15s ease-in;
}

.cm-software-manual .cm-manual-toc a:hover {
	color: #f4f4f4;
}

/* ─── Archive Card Styles ─── */

/* Flexbox grid: centers incomplete rows (1–2 items) */
.wp-block-post-template.is-layout-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4rem;
}

.cm-card {
	position: relative;
	overflow: hidden;
	border-radius: 0;
	background: transparent;
	transition: transform 0.5s, background-color 0.5s;
}

.cm-card .wp-block-post-featured-image {
	margin: 0;
	position: relative;
	overflow: hidden;
}

/* The featured-image link must be block-level for the square crop to work when
 * core's wp-block-post-featured-image stylesheet isn't enqueued (e.g. the
 * hand-rendered cards on the genre archive). */
.cm-card .wp-block-post-featured-image a {
	display: block;
	line-height: 0;
}

.cm-card .wp-block-post-featured-image::before {
	content: '';
	position: absolute;
	bottom: 100%;
	left: 0;
	right: 0;
	top: 0;
	background: linear-gradient(to top left,
		rgba(255, 255, 255, 0.1),
		rgba(255, 255, 255, 0.5),
		rgba(255, 255, 255, 0.1)
	);
	transition: all 0.5s ease;
	pointer-events: none;
	opacity: 0;
	filter: blur(20px);
	z-index: 1;
}

.cm-card:hover .wp-block-post-featured-image::before {
	bottom: 0;
	opacity: 1;
}

.cm-card .wp-block-post-featured-image img {
	border-radius: 0;
	aspect-ratio: 1;
	object-fit: cover;
	width: 100%;
	/* height:auto lets aspect-ratio drive the height; without it the image's
	 * height="…" attribute keeps the crop from squaring up. */
	height: auto;
	display: block;
	margin: 0;
}

.cm-card-body {
	background: #f4f4f4;
	padding: 1rem;
	text-align: center;
	margin: 0;
}

.cm-card-body .wp-block-post-title {
	margin-bottom: 0.5rem;
}

.cm-card-title a,
.cm-card-body .wp-block-post-title a {
	color: #000;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	display: block;
	text-transform: uppercase;
	letter-spacing: 0.1rem;
	font-size: 0.875rem;
	font-weight: 700;
}

.cm-card-title a:hover,
.cm-card-body .wp-block-post-title a:hover {
	opacity: 0.6;
}

.cm-archive-meta {
	color: #111;
	font-size: 0.875rem;
	font-weight: 100;
	margin: 0 0 1rem 0;
	text-align: center;
}

.cm-archive-meta a {
	color: inherit;
}

.wp-site-blocks .cm-archive-meta:hover {
	color: #111;
}

.cm-card-body .wp-block-read-more.cm-card-badge {
	display: block;
	width: 75%;
	margin: 0 auto;
	text-align: center;
	background: #111;
	color: #f4f4f4;
	text-decoration: none;
	padding: 0.5rem 0;
	text-transform: uppercase;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.1rem;
	transition: background-color 0.2s ease;
	border: none;
	box-sizing: border-box;
}

.cm-card-body .wp-block-read-more.cm-card-badge:hover {
	background: #333;
	color: #fff;
}

/* ─── Genre Archive ─── */

.cm-genre-header {
	text-align: center;
	margin-bottom: var(--wp--preset--spacing--60);
}

.cm-genre-description {
	color: #999;
	font-weight: 100;
	max-width: 60ch;
	margin: 0.75rem auto 0;
}

.cm-genre-description p {
	margin: 0;
}

/* Subgenre chips */
.cm-genre-chips {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	margin-bottom: var(--wp--preset--spacing--60);
}

.cm-genre-chip {
	display: inline-block;
	padding: 0.35rem 0.9rem;
	font-size: 0.75rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #bbb;
	text-decoration: none;
	border: 1px solid rgba(244, 244, 244, 0.2);
	border-radius: 2rem;
	transition: color 0.15s ease-in, border-color 0.15s ease-in;
}

.cm-genre-chip:hover {
	color: #f4f4f4;
	border-color: var(--wp--preset--color--accent-1);
}

/* Sections */
.cm-genre-section {
	margin-block: var(--wp--preset--spacing--60);
}

.cm-genre-heading {
	font-size: clamp(1.25rem, 1rem + 1.5vw, 1.625rem);
	font-weight: 400;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #bbb;
	margin-bottom: var(--wp--preset--spacing--50);
	text-align: center;
}

/* Reset the hand-rendered post-template list (core's reset stylesheet only
 * loads when a real Query Loop is on the page) */
.cm-genre-section .wp-block-post-template {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Empty-cover placeholder for cards with no image (keeps the square) */
.cm-card-img-empty {
	display: block;
	aspect-ratio: 1;
	background: var(--wp--preset--color--accent-5, #141414);
}

.cm-genre-empty {
	text-align: center;
	color: #777;
	font-weight: 100;
}

/* ─── Software Version Badge & Last Update ─── */

.cm-version-badge {
	text-align: left;
	color: #999;
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 0.15rem;
	margin: 0.25rem 0 0 0;
}

/* Last update — positioned like release streaming links footer */
.cm-last-update {
	text-align: left;
	color: #666;
	font-size: 0.8rem;
	font-weight: 700;
	margin-top: var(--wp--preset--spacing--40);
	letter-spacing: 0.05em;
}

/* ─── Gallery Image Titles (matching Hugo card-body pattern) ─── */

.cm-gallery-title {
	background: #f4f4f4;
	display: block;
	width: 100%;
	padding: 0.5rem 0.75rem;
	box-sizing: border-box;
}

.cm-gallery-title span {
	display: block;
	color: #000;
	font-size: 0.875rem;
	font-weight: 700;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	line-height: 1.4rem;
	letter-spacing: 0.1rem;
}

.cm-gallery-item {
	margin: 0;
	padding: 0;
	overflow: hidden;
	border-radius: 0;
}

.cm-gallery-item a {
	display: block;
	position: relative;
	overflow: hidden;
	cursor: zoom-in;
	text-decoration: none;
	border: none;
	outline: none;
	box-shadow: none;
}

.cm-gallery-item img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
	border-radius: 0;
}

.cm-release-gallery .cm-gallery-item img,
.cm-portfolio-gallery .cm-gallery-item img {
	aspect-ratio: 1;
}

.cm-software-gallery .cm-gallery-item img {
	aspect-ratio: 16 / 9;
}


/* ─── Section Headings (Description, etc.) ─── */

.wp-block-heading[style*="font-weight:100"] {
	color: #f4f4f4;
}

/* ─── Portfolio Section Heading ─── */

.cm-portfolio-section-heading {
	text-align: center;
	margin-top: 0;
}

@media (min-width: 1024px) {
	.cm-portfolio-section-heading {
		text-align: left;
	}
}

/* ─── Single-page Description Content (matching Hugo f4 lh-copy fw1 tj) ─── */

.single-cm_portfolio .entry-content,
.single-cm_release .entry-content,
.single-cm_software .entry-content {
	font-size: 1.25rem;
	font-weight: 100;
	line-height: 1.65;
	text-align: justify;
}

/* ─── Blockquote (matching Hugo/Ananke lh-copy blockquote) ─── */

.single-cm_portfolio .entry-content blockquote,
.single-cm_release .entry-content blockquote,
.single-cm_software .entry-content blockquote {
	border-left: 4px solid #ccc;
	padding-left: 1rem;
	margin-left: 0;
	margin-top: 2rem;
	margin-bottom: 2rem;
	font-style: italic;
	font-size: 1rem;
}

.single-cm_portfolio .entry-content blockquote p,
.single-cm_release .entry-content blockquote p,
.single-cm_software .entry-content blockquote p {
	margin: 0;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
}

/* ─── Paragraphs — explicit font settings matching Hugo f4 lh-copy fw1 ─── */

.single-cm_portfolio .entry-content > p,
.single-cm_release .entry-content > p,
.single-cm_software .entry-content > p {
	font-size: 1.25rem;
	font-weight: 100;
	line-height: 1.65;
}

/* ─── Release content heading hierarchy ─── */
/* Dark bg guide: reduce weight — light text appears heavier than it is.
 * Weight 400 (not bold) keeps H3/H4 distinct from body (weight 100) without
 * competing with the H1 title. */
.single-cm_release .entry-content h3 {
	font-size: 1.25rem;
	font-weight: 400;
	color: #d0d0d0;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-block-start: 2em;
}

.single-cm_release .entry-content h4 {
	font-size: 1.25rem;
	font-weight: 400;
	color: #bbb;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-block-start: 1.75em;
}

/* ─── Hamburger Menu — Mobile Nav ─── */

/*
 * Strategy: Let WP handle the overlay mechanics (fixed positioning,
 * open/close). We only restyle the appearance: frosted glass background,
 * centered links, hide WP close button, custom hamburger→X icon.
 */

/* Open button: strip browser/WP defaults, ensure it's above overlay */
.wp-block-navigation__responsive-container-open {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.5rem;
	position: relative;
	z-index: 100001;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
}

.wp-block-navigation__responsive-container-open .cm-hamburger {
	pointer-events: none;
}

/* Hide WP's default SVG — replaced by JS with .cm-hamburger */
.centomila-header .wp-block-navigation__responsive-container-open svg {
	display: none;
}

/* ── Hamburger icon: 3 bars → X ── */

.cm-hamburger {
	display: block;
	width: 30px;
	height: 25px;
	position: relative;
}

.cm-bar {
	display: block;
	width: 30px;
	height: 4px;
	background-color: #3d3d3d;
	position: absolute;
	left: 0;
	transition: transform 0.25s ease, opacity 0.25s ease, top 0.25s ease;
}

.cm-bar:nth-child(1) { top: 0; }
.cm-bar:nth-child(2) { top: 10px; }
.cm-bar:nth-child(3) { top: 20px; }

.cm-hamburger.is-active .cm-bar:nth-child(1) {
	top: 10px;
	transform: rotate(45deg);
}
.cm-hamburger.is-active .cm-bar:nth-child(2) {
	opacity: 0;
}
.cm-hamburger.is-active .cm-bar:nth-child(3) {
	top: 10px;
	transform: rotate(-45deg);
}

/* ── Header expansion: grows to full viewport height ── */

header.wp-block-template-part.cm-menu-open {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 100vh;
	z-index: 99999;
}

/* Frosted glass fills the expanded header */
header.wp-block-template-part.cm-menu-open .centomila-header {
	min-height: 100vh;
	background-color: rgba(255, 255, 255, 0.85);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

/* ── WP overlay: transparent — frosted glass comes from the header ── */

/* Specificity matches WP's (0,3,0) padding rule and (0,5,0) background rule */
.wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
	padding: 0;
	display: flex;
	flex-direction: column;
}

.centomila-nav:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
	background: transparent;
	animation: none;
}

/* Hide WP's X close button — our hamburger icon handles close */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
	display: none;
}

/* Inner wrappers must stretch to fill the overlay for vertical centering */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
	display: flex;
	flex-direction: column;
	flex: 1;
}

/* Center the nav content in the space below the navbar.
 * position:fixed escapes every parent containing block and always positions
 * against the viewport — no flex-chain or contain-block ambiguity.
 * 4.5rem = 20px top padding + 2rem logo + 20px bottom padding.
 * padding-top:0 overrides the 56px WP adds for its own (hidden) close button.
 * .centomila-nav ancestor raises specificity to (0,3,0) to beat WP's rule. */
.centomila-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	--navigation-layout-justification-setting: center;
	position: fixed;
	top: 4.5rem;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding-top: 0;
	text-align: center;
}

/* Item list (UL): override WP's items-justified-right + flex:1 rules.
 * Selector includes .items-justified-right for (0,3,0) specificity to beat WP's rule. */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container.items-justified-right {
	flex-grow: 0;
	justify-content: center;
	align-items: center;
	text-align: center;
	gap: 0.5rem;
}

/* Each nav item: centered */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	--navigation-layout-justification-setting: center;
	align-items: center;
	text-align: center;
	width: 100%;
}

/* Link styling */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	color: #111;
	font-size: 1.75rem;
	text-transform: uppercase;
	letter-spacing: 0.2rem;
	font-weight: 700;
	text-decoration: none;
	padding: 0.6rem 1.25rem;
	transition: color 0.15s ease;
	display: block;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover {
	color: rgba(0, 0, 0, 0.4);
}

/* ─── Responsive: Phone only (< 768px) ─── */

@media (max-width: 767px) {

	/* Reduce spacing on small-screen main padding */
	main.wp-block-group {
		padding-top: var(--wp--preset--spacing--40);
	}

	/* Section dividers — less vertical spacing on phones */
	.wp-block-group.alignwide[style*="border-top"],
	.wp-block-group.alignfull[style*="border-top"] {
		padding-top: var(--wp--preset--spacing--40);
		padding-bottom: var(--wp--preset--spacing--40);
	}

	/* Archive grid: 1 column on phones */
	.wp-block-post-template.is-layout-grid > li {
		flex: 0 1 100%;
		max-width: 100%;
	}
}

/* ─── Responsive: Phone + Tablet (< 1024px) ─── */

@media (max-width: 1023px) {

	/* --- Nav: hamburger replaces inline nav ---
	 * Specificity (0,4,0): .centomila-header + .wp-block-navigation + .centomila-nav + button class
	 * beats WP's :where()-wrapped generated styles (0,0,0) and its doubled-class fallbacks (0,2,0) */
	.centomila-header .wp-block-navigation.centomila-nav .wp-block-navigation__responsive-container-open {
		display: block;
	}

	.centomila-header .wp-block-navigation.centomila-nav .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none;
	}

	/* --- Layout: stack columns --- */
	.wp-block-columns {
		flex-direction: column;
		flex-wrap: nowrap;
	}

	.wp-block-columns > .wp-block-column {
		flex-basis: 100%;
		width: 100%;
	}

	/* --- Single pages: center-align content on mobile --- */
	.cm-track-list {
		text-align: center;
	}

	.cm-track-item {
		justify-content: center;
	}

}

/* ─── Responsive: Tablet only (768px – 1023px) ─── */

@media (min-width: 768px) and (max-width: 1023px) {

	/* Archive grid: 2 columns on tablet */
	.wp-block-post-template.is-layout-grid > li {
		flex: 0 1 calc((100% - 4rem) / 2);
		max-width: calc((100% - 4rem) / 2);
	}

	/* Gallery: 2 columns on tablet */
	.cm-release-gallery > .cm-gallery-item,
	.cm-software-gallery > .cm-gallery-item,
	.cm-portfolio-gallery > .cm-gallery-item {
		flex: 0 1 calc((100% - 4rem) / 2);
		max-width: calc((100% - 4rem) / 2);
	}
}

/* ─── Responsive: Desktop (≥ 1024px) ─── */

@media (min-width: 1024px) {

	/* Nav: full inline navigation, hamburger hidden */
	.centomila-header .wp-block-navigation.centomila-nav .wp-block-navigation__responsive-container-open {
		display: none;
	}

	.centomila-header .wp-block-navigation.centomila-nav .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: flex;
	}

	/* Right-align on desktop — track list only */
	.cm-track-list {
		text-align: right;
	}

	.cm-track-item {
		justify-content: flex-end;
	}

	/* Archive grid: 3 columns on desktop */
	.wp-block-post-template.is-layout-grid > li {
		flex: 0 1 calc((100% - 8rem) / 3);
		max-width: calc((100% - 8rem) / 3);
	}

	/* Gallery: 3 columns on desktop */
	.cm-release-gallery > .cm-gallery-item,
	.cm-software-gallery > .cm-gallery-item,
	.cm-portfolio-gallery > .cm-gallery-item {
		flex: 0 1 calc((100% - 8rem) / 3);
		max-width: calc((100% - 8rem) / 3);
	}
}

/* ─── Software Prev/Next Navigation ─── */

.cm-software-nav-section:not(:has(.cm-release-nav)) {
	display: none;
}

/* ─── Portfolio Prev/Next Navigation ─── */

.cm-portfolio-nav-section:not(:has(.cm-release-nav)) {
	display: none;
}

.cm-portfolio-gallery-section:has(.cm-portfolio-gallery) + .cm-portfolio-nav-section {
	margin-top: 0;
}

.cm-portfolio-gallery-section:not(:has(.cm-portfolio-gallery)) + .cm-portfolio-nav-section {
	margin-top: var(--wp--preset--spacing--60);
}

/* ─── Release Prev/Next Navigation ─── */

.cm-release-nav-section:not(:has(.cm-release-nav)) {
	display: none;
}

/* Gallery visible → nav follows directly (border-top is the separator) */
.cm-release-gallery-section:has(.cm-release-gallery) + .cm-release-nav-section {
	margin-top: 0;
}

/* Gallery absent (hidden) → nav gets the same top gap the gallery would have provided */
.cm-release-gallery-section:not(:has(.cm-release-gallery)) + .cm-release-nav-section {
	margin-top: var(--wp--preset--spacing--60);
}

.cm-release-nav {
	display: flex;
	gap: var(--wp--preset--spacing--60);
	max-width: var(--wp--style--global--wide-size, 1280px);
	margin-left: auto;
	margin-right: auto;
	width: 100%;
}

.cm-release-nav-item {
	display: flex;
	align-items: center;
	gap: 1rem;
	text-decoration: none;
	color: #999;
	padding: 1rem;
	border: 1px solid rgba(244, 244, 244, 0.08);
	transition: border-color 0.15s ease-in, background-color 0.15s ease-in;
	flex: 1;
	min-width: 0;
}

.cm-release-nav-item:hover {
	border-color: rgba(244, 244, 244, 0.2);
	background-color: rgba(244, 244, 244, 0.04);
}

/* DOM order is already [info][thumb] for correct mirror layout */
.cm-release-nav-next {
	text-align: right;
	justify-content: flex-end;
}

.cm-release-nav-thumb {
	display: block;
	flex-shrink: 0;
	width: 72px;
	height: 72px;
	overflow: hidden;
}

.cm-release-nav-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cm-release-nav-info {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	min-width: 0;
}

.cm-release-nav-label {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.15rem;
	color: var(--wp--preset--color--accent-1);
	line-height: 1;
}

.cm-release-nav-title {
	font-size: 0.9rem;
	font-weight: 700;
	color: #f4f4f4;
	text-transform: uppercase;
	letter-spacing: 0.05rem;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
}

@media (max-width: 767px) {
	.cm-release-nav {
		flex-direction: column;
	}

	.cm-release-nav-next {
		text-align: left;
	}
}

/* ─── Gallery & cover thumbnail hover ─── */

/* Base: all lightbox anchors need a positioning root and overflow clip */
.galleryBaguetteBox a {
	display: block;
	position: relative;
	overflow: hidden;
	cursor: zoom-in;
}

/* Ensure cover image anchor fills its figure */
.wp-block-post-featured-image.galleryBaguetteBox a {
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
	cursor: zoom-in;
}

/* Dark overlay */
.galleryBaguetteBox a::before {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 10, 0.5);
	opacity: 0;
	transition: opacity 0.25s ease;
	z-index: 1;
	pointer-events: none;
}

/* Lens icon — minimal magnifier SVG */
.galleryBaguetteBox a::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 2rem;
	height: 2rem;
	transform: translate(-50%, -50%) scale(0.75);
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7'/%3E%3Cline x1='15' y1='15' x2='21' y2='21'/%3E%3C/svg%3E") center / contain no-repeat;
	opacity: 0;
	transition: opacity 0.2s ease, transform 0.25s ease;
	z-index: 2;
	pointer-events: none;
}

.galleryBaguetteBox a:hover::before {
	opacity: 1;
}

.galleryBaguetteBox a:hover::after {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* ─── baguetteBox lightbox overrides ─── */

/* Frosted glass backdrop */
#baguetteBox-overlay {
	-webkit-backdrop-filter: blur(20px);
	backdrop-filter: blur(20px);
}

/* Prevent image from rendering behind the caption strip or close button */
#baguetteBox-overlay .full-image {
	padding: 1.5rem;
	padding-bottom: 3.5rem;
	box-sizing: border-box;
}

/* Caption: 0.75rem top/bottom (half of 1.5rem base), 1.5rem sides to align with close button */
#baguetteBox-overlay .full-image figcaption {
	padding: 0.75rem 1.5rem;
}

/* Close button: no background, no rounded rect */
#baguetteBox-overlay .baguetteBox-button#close-button {
	background: transparent;
	border-radius: 0;
	width: 30px;
	height: 30px;
	top: 1.5rem;
	right: 1.5rem;
}

#baguetteBox-overlay .baguetteBox-button#close-button:hover,
#baguetteBox-overlay .baguetteBox-button#close-button:focus {
	background: transparent;
}

/* Hide the default SVG X */
#baguetteBox-overlay .baguetteBox-button#close-button svg {
	display: none;
}

/* Two crossing bars matching .cm-hamburger.is-active style */
#baguetteBox-overlay .baguetteBox-button#close-button::before,
#baguetteBox-overlay .baguetteBox-button#close-button::after {
	content: '';
	display: block;
	position: absolute;
	top: 50%;
	left: 0;
	width: 30px;
	height: 3px;
	background-color: #f0f0f0;
	border-radius: 2px;
	margin-top: -1.5px;
	transition: opacity 0.25s ease;
}

#baguetteBox-overlay .baguetteBox-button#close-button::before {
	transform: rotate(45deg);
}

#baguetteBox-overlay .baguetteBox-button#close-button::after {
	transform: rotate(-45deg);
}
