/**
 * Flavor Theme — Custom Styles
 * Industrial Brutalist Aesthetic — MOSHPIT EDITION
 *
 * IMPORTANT: No .mg-* classes here — MoshpitGallery handles its own CSS.
 */

/* === NOISE + GRAIN TEXTURE === */
body {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

/* Scanline overlay on the whole page */
body::after {
	content: '';
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 99999;
	background: repeating-linear-gradient(
		0deg,
		transparent,
		transparent 2px,
		rgba(0, 0, 0, 0.03) 2px,
		rgba(0, 0, 0, 0.03) 4px
	);
}

/* === SITE LOGO === */
.site-logo img,
.site-header .wp-block-site-logo img {
	max-height: 50px;
	width: auto;
	filter: brightness(1.1);
	transition: filter 0.3s;
}
.site-header .wp-block-site-logo img:hover {
	filter: brightness(1.3) drop-shadow(0 0 8px rgba(192, 57, 43, 0.5));
}

.hero-logo img,
.hero-section .wp-block-site-logo img {
	max-width: 400px;
	width: 100%;
	height: auto;
	margin-bottom: 1.5rem;
	filter: brightness(1.1) drop-shadow(0 0 30px rgba(192, 57, 43, 0.3));
	animation: logoGlow 3s ease-in-out infinite alternate;
}

@keyframes logoGlow {
	from { filter: brightness(1.1) drop-shadow(0 0 20px rgba(192, 57, 43, 0.2)); }
	to   { filter: brightness(1.2) drop-shadow(0 0 40px rgba(192, 57, 43, 0.5)); }
}

/* === STICKY HEADER === */
.site-header {
	position: sticky;
	top: 0;
	z-index: 9999;
	backdrop-filter: blur(16px) saturate(1.2);
	-webkit-backdrop-filter: blur(16px) saturate(1.2);
	background: rgba(10, 10, 10, 0.88) !important;
	transition: box-shadow 0.3s;
}

.site-header:hover {
	box-shadow: 0 4px 30px rgba(192, 57, 43, 0.15);
}

/* Logged-in admin bar offset */
.admin-bar .site-header {
	top: 32px;
}
@media (max-width: 782px) {
	.admin-bar .site-header {
		top: 46px;
	}
}

/* === HEADINGS — BRUTAL TYPOGRAPHY === */
h1, h2, h3, h4,
.wp-block-heading {
	text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
}

h2.wp-block-heading {
	position: relative;
	padding-bottom: 0.5rem;
}

h2.wp-block-heading::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	width: 60px;
	height: 4px;
	background: var(--wp--preset--color--accent);
}

/* Section headings centered get centered accent bar */
.has-text-align-center h2.wp-block-heading::after,
h2.wp-block-heading.has-text-align-center::after {
	left: 50%;
	transform: translateX(-50%);
}

/* === HERO SECTION === */
.hero-section {
	margin-bottom: 0 !important;
	position: relative;
	overflow: hidden;
}

.hero-section::before {
	content: '';
	position: absolute;
	inset: 0;
	background:
		repeating-linear-gradient(
			0deg,
			transparent,
			transparent 3px,
			rgba(0, 0, 0, 0.05) 3px,
			rgba(0, 0, 0, 0.05) 6px
		);
	pointer-events: none;
	z-index: 1;
}

.hero-section .wp-block-cover__inner-container {
	position: relative;
	z-index: 2;
}

/* Accent line at bottom of hero */
.hero-section::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: linear-gradient(90deg, transparent, var(--wp--preset--color--accent), transparent);
	z-index: 3;
}

/* === BENTO GRID === */
.bento-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	grid-auto-rows: minmax(280px, auto);
	gap: 4px;
}

.bento-tile {
	overflow: hidden;
	position: relative;
	border: 1px solid rgba(51, 51, 51, 0.5);
	transition: border-color 0.3s, box-shadow 0.3s;
}

.bento-tile:hover {
	border-color: var(--wp--preset--color--accent);
	box-shadow: 0 0 20px rgba(192, 57, 43, 0.2), inset 0 0 20px rgba(192, 57, 43, 0.05);
}

.bento-tile--featured {
	grid-column: span 2;
	grid-row: span 2;
}

.bento-tile--wide {
	grid-column: span 2;
}

.bento-tile__cover {
	transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bento-tile:hover .bento-tile__cover {
	transform: scale(1.05);
}

/* Bento tile overlay gradient */
.bento-tile::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 50%;
	background: linear-gradient(to top, rgba(10, 10, 10, 0.8) 0%, transparent 100%);
	pointer-events: none;
	z-index: 1;
}

@media (max-width: 960px) {
	.bento-grid {
		grid-template-columns: repeat(2, 1fr);
		grid-auto-rows: minmax(220px, auto);
	}
	.bento-tile--featured {
		grid-column: span 2;
		grid-row: span 1;
	}
	.bento-tile--wide {
		grid-column: span 2;
	}
}

@media (max-width: 480px) {
	.bento-grid {
		grid-template-columns: 1fr;
		grid-auto-rows: minmax(200px, auto);
	}
	.bento-tile--featured,
	.bento-tile--wide {
		grid-column: span 1;
		grid-row: span 1;
	}
}

/* === CARDS — INDUSTRIAL === */
.news-card,
.gallery-card,
.archive-card {
	background: var(--wp--preset--color--surface);
	border: 2px solid var(--wp--preset--color--border);
	overflow: hidden;
	position: relative;
	transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

/* Accent corner slash */
.news-card::before,
.gallery-card::before,
.archive-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 4px;
	height: 0;
	background: var(--wp--preset--color--accent);
	transition: height 0.3s ease;
	z-index: 2;
}

.news-card:hover::before,
.gallery-card:hover::before,
.archive-card:hover::before {
	height: 100%;
}

.news-card:hover,
.gallery-card:hover,
.archive-card:hover {
	border-color: var(--wp--preset--color--accent);
	transform: translateY(-4px);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(192, 57, 43, 0.1);
}

/* Card image zoom on hover */
.news-card .wp-block-post-featured-image img,
.gallery-card .gallery-card__image img,
.archive-card .wp-block-post-featured-image img {
	width: 100%;
	display: block;
	transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.5s;
}

.news-card:hover .wp-block-post-featured-image img,
.gallery-card:hover .gallery-card__image img,
.archive-card:hover .wp-block-post-featured-image img {
	transform: scale(1.06);
	filter: contrast(1.1) saturate(1.1);
}

.news-card .wp-block-post-featured-image,
.gallery-card .gallery-card__image,
.archive-card .wp-block-post-featured-image {
	margin: 0;
	overflow: hidden;
}

/* === ARCHIVE GRID CARDS === */
.wp-block-post-template .wp-block-post {
	position: relative;
	transition: transform 0.3s, box-shadow 0.3s;
}

.wp-block-post-template .wp-block-post:hover {
	transform: translateY(-3px);
}

/* Post featured images in grids */
.wp-block-post-template .wp-block-post-featured-image {
	overflow: hidden;
}

.wp-block-post-template .wp-block-post-featured-image img {
	transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.wp-block-post-template .wp-block-post:hover .wp-block-post-featured-image img {
	transform: scale(1.05);
}

/* === SINGLE POST HERO === */
.single-hero {
	margin-bottom: 0 !important;
	position: relative;
	overflow: hidden;
}

.single-hero img {
	width: 100%;
	max-height: 50vh;
	object-fit: cover;
	filter: contrast(1.05);
}

/* Gradient fade at bottom */
.single-hero::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 120px;
	background: linear-gradient(to top, var(--wp--preset--color--base) 0%, transparent 100%);
	pointer-events: none;
}

/* === LINKS — ACCENT UNDERLINE ANIMATION === */
.wp-block-post-content a:not(.wp-block-button__link),
.entry-content a:not(.wp-block-button__link) {
	text-decoration: none;
	background-image: linear-gradient(var(--wp--preset--color--accent), var(--wp--preset--color--accent));
	background-size: 0% 2px;
	background-position: 0 100%;
	background-repeat: no-repeat;
	transition: background-size 0.3s ease;
}

.wp-block-post-content a:not(.wp-block-button__link):hover,
.entry-content a:not(.wp-block-button__link):hover {
	background-size: 100% 2px;
}

/* === BUTTONS — INDUSTRIAL === */
.wp-block-button__link,
.wp-element-button {
	position: relative;
	overflow: hidden;
	transition: all 0.3s ease;
	border: 2px solid var(--wp--preset--color--accent) !important;
}

.wp-block-button__link:hover,
.wp-element-button:hover {
	box-shadow: 0 0 20px rgba(192, 57, 43, 0.3);
	transform: translateY(-1px);
}

/* Sweep effect */
.wp-block-button__link::after,
.wp-element-button::after {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
	transition: left 0.5s ease;
}

.wp-block-button__link:hover::after,
.wp-element-button:hover::after {
	left: 100%;
}

/* === SEPARATORS — BRUTALIST === */
.wp-block-separator {
	position: relative;
	overflow: visible;
}

.wp-block-separator.is-style-wide {
	height: 4px !important;
	border: none !important;
	background: linear-gradient(90deg,
		transparent,
		var(--wp--preset--color--accent) 20%,
		var(--wp--preset--color--accent) 80%,
		transparent
	) !important;
}

/* === BLOCKQUOTE — INDUSTRIAL === */
.wp-block-quote {
	position: relative;
}

.wp-block-quote::before {
	content: '\201C';
	position: absolute;
	top: -20px;
	left: -10px;
	font-size: 5rem;
	color: var(--wp--preset--color--accent);
	opacity: 0.2;
	font-family: serif;
	line-height: 1;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
	width: 8px;
}

::-webkit-scrollbar-track {
	background: var(--wp--preset--color--base);
}

::-webkit-scrollbar-thumb {
	background: var(--wp--preset--color--accent);
	border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--wp--preset--color--accent-hover);
}

/* Firefox */
html {
	scrollbar-width: thin;
	scrollbar-color: var(--wp--preset--color--accent) var(--wp--preset--color--base);
}

/* === SELECTION === */
::selection {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--heading);
}

/* === NAVIGATION === */
.wp-block-navigation a {
	position: relative;
}

.wp-block-navigation a::after {
	content: '';
	position: absolute;
	bottom: -4px;
	left: 0;
	width: 0;
	height: 2px;
	background: var(--wp--preset--color--accent);
	transition: width 0.3s ease;
}

.wp-block-navigation a:hover::after {
	width: 100%;
}

/* Navigation Mobile Overlay */
.wp-block-navigation__responsive-container.is-menu-open {
	z-index: 9998;
}

/* === SOCIAL LINKS — GLOW HOVER === */
.wp-block-social-links .wp-social-link {
	transition: transform 0.3s, filter 0.3s;
}

.wp-block-social-links .wp-social-link:hover {
	transform: scale(1.2);
	filter: drop-shadow(0 0 8px rgba(192, 57, 43, 0.6));
}

/* === FOOTER === */
footer .wp-block-site-title a,
footer .wp-block-site-logo img {
	filter: brightness(0.9);
	transition: filter 0.3s;
}

footer .wp-block-site-title a:hover,
footer .wp-block-site-logo img:hover {
	filter: brightness(1.1) drop-shadow(0 0 8px rgba(192, 57, 43, 0.3));
}

/* === FOCUS STYLES (Accessibility) === */
:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

/* === QUERY LOOP GRID RESPONSIVE === */
@media (max-width: 768px) {
	.wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 480px) {
	.wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
	}
}

/* === PAGINATION === */
.wp-block-query-pagination-numbers .page-numbers {
	padding: 0.5rem 0.75rem;
	border: 2px solid var(--wp--preset--color--border);
	transition: all 0.3s;
}

.wp-block-query-pagination-numbers .page-numbers.current {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
	box-shadow: 0 0 10px rgba(192, 57, 43, 0.2);
}

.wp-block-query-pagination-numbers .page-numbers:hover {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
	transform: translateY(-2px);
}

/* === IMAGES — SUBTLE GRAIN ON ALL POST IMAGES === */
.wp-block-post-featured-image {
	position: relative;
}

.wp-block-post-featured-image::after {
	content: '';
	position: absolute;
	inset: 0;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23g)' opacity='0.04'/%3E%3C/svg%3E");
	pointer-events: none;
	mix-blend-mode: overlay;
}

/* === FADE-IN ANIMATION (triggered by frontend.js) === */
.fade-in-up {
	opacity: 0;
	transform: translateY(30px);
	transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fade-in-up.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Staggered delays for grid items */
.fade-in-up:nth-child(2) { transition-delay: 0.1s; }
.fade-in-up:nth-child(3) { transition-delay: 0.2s; }
.fade-in-up:nth-child(4) { transition-delay: 0.3s; }
.fade-in-up:nth-child(5) { transition-delay: 0.4s; }
.fade-in-up:nth-child(6) { transition-delay: 0.5s; }

/* === GLITCH EFFECT FOR HERO TEXT (optional class) === */
.glitch-text {
	position: relative;
}

.glitch-text::before,
.glitch-text::after {
	content: attr(data-text);
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.glitch-text::before {
	animation: glitch-1 3s infinite linear alternate-reverse;
	clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
	color: var(--wp--preset--color--accent);
	opacity: 0.5;
}

.glitch-text::after {
	animation: glitch-2 2.5s infinite linear alternate-reverse;
	clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
	color: #3498db;
	opacity: 0.3;
}

@keyframes glitch-1 {
	0%, 90% { transform: translate(0); }
	91% { transform: translate(-2px, 1px); }
	93% { transform: translate(2px, -1px); }
	95% { transform: translate(-1px, 2px); }
	97% { transform: translate(1px, -2px); }
	100% { transform: translate(0); }
}

@keyframes glitch-2 {
	0%, 88% { transform: translate(0); }
	89% { transform: translate(2px, 1px); }
	92% { transform: translate(-2px, -1px); }
	94% { transform: translate(1px, 2px); }
	96% { transform: translate(-1px, -2px); }
	100% { transform: translate(0); }
}

/* === FILM STRIP BORDER FOR IMAGES === */
.wp-block-gallery {
	position: relative;
	padding: 12px;
	border: 2px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--surface);
}

/* === HORIZONTAL RULES / SECTION DIVIDERS === */
.section-divider {
	width: 100%;
	height: 4px;
	background: linear-gradient(90deg,
		var(--wp--preset--color--accent) 0%,
		var(--wp--preset--color--accent) 30%,
		var(--wp--preset--color--border) 30%,
		var(--wp--preset--color--border) 100%
	);
	border: none;
}
