/*
Theme Name: Melon Men
Description: Theme for The Melon Men, 2b2t's helping community. Pages are built from normal blocks, so everything can be edited in the WordPress editor.
Version: 1.4.0
Requires at least: 6.6
Requires PHP: 7.4
Text Domain: melonmen
*/

/* Colours and fonts live in theme.json (Appearance > Editor > Styles). This file is layout and effects. */

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

/* WordPress adds a gap between every block; full-width sections should touch. */
.wp-site-blocks > * + *,
.mm-main > * + *,
.mm-sections > * + * { margin-block-start: 0 !important; }

.wp-site-blocks { padding: 0; }

/* ---------- Header ---------- */
.mm-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	padding: 1rem max(2rem, calc((100% - 1400px) / 2));
	background: rgba(0, 0, 0, 0.15);
	backdrop-filter: blur(15px);
	-webkit-backdrop-filter: blur(15px);
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
	color: #fff;
}

.admin-bar .mm-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .mm-header { top: 46px; } }

/* In the editor the header sits in the page instead of floating over it. */
.editor-styles-wrapper .mm-header { position: relative; top: 0; background: var(--wp--preset--color--dark); }

.mm-header a { color: #fff; text-decoration: none; }

.mm-logo { font-size: 1.5rem; font-weight: 700; margin: 0; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }

.mm-header .mm-brand { gap: 0.6rem !important; }
.mm-logo-img { margin: 0; line-height: 0; }
.mm-logo-img img { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); }

/* The leaf icon is only a fallback for when no Site Logo image is set. */
.mm-header:not(:has(.wp-block-site-logo img)) .mm-logo a::before {
	font-family: "Font Awesome 6 Free";
	font-weight: 900;
	content: "\f4d8";
	margin-right: 0.5rem;
}

.mm-nav .wp-block-navigation-item__content {
	padding: 0.5rem 1rem;
	border-radius: 20px;
	font-weight: 500;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
	transition: background 0.3s;
}

.mm-nav .wp-block-navigation-item__content:hover,
.mm-nav .current-menu-item > .wp-block-navigation-item__content { background: rgba(255, 255, 255, 0.2); }

.mm-nav .wp-block-navigation__container { gap: 0.25rem; }

/* backdrop-filter traps position:fixed children, which squashed the phone menu into the header bar. */
.mm-header:has(.is-menu-open) { backdrop-filter: none; -webkit-backdrop-filter: none; }
@media (max-width: 599px) {
	.mm-header { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(15, 20, 25, 0.6); }
}

/* Phone menu: full-screen list of big buttons. */
.mm-nav .wp-block-navigation__responsive-container.is-menu-open { padding: 1.25rem 1.5rem 2rem; }
.mm-nav .is-menu-open .wp-block-navigation__responsive-dialog { padding-top: 4rem; }
.mm-nav .is-menu-open .wp-block-navigation__responsive-container-content,
.mm-nav .is-menu-open .wp-block-navigation__container { align-items: stretch !important; width: 100%; gap: 0.4rem !important; }
.mm-nav .is-menu-open .wp-block-navigation-item { width: 100%; box-sizing: border-box; margin: 0; }
.mm-nav .is-menu-open .wp-block-navigation-item__content {
	display: block;
	box-sizing: border-box;
	width: 100%;
	padding: 0.9rem 1.2rem !important;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.06);
	font-size: 1.3rem;
	text-align: center;
}
.mm-nav .is-menu-open .current-menu-item > .wp-block-navigation-item__content { background: var(--wp--preset--color--green); }
.mm-nav .is-menu-open .wp-block-navigation__responsive-container-close svg { width: 34px; height: 34px; }

/* ---------- Shared ---------- */
.mm-section { padding: 4rem 2rem; }

.mm-bg-light { background: var(--wp--preset--color--light); }

.mm-title { font-size: 2.5rem; margin-bottom: 1rem; }

.mm-subtitle { color: var(--wp--preset--color--muted); font-size: 1.1rem; max-width: 600px !important; margin-bottom: 3rem; }

.mm-lead { font-size: 1.2rem; max-width: 700px !important; }

.mm-cards { gap: 1.5rem; margin-bottom: 1.5rem; }

.mm-cards > .wp-block-column { display: flex; }

.mm-card {
	background: #fff;
	border-radius: 15px;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
	padding: 2rem;
	width: 100%;
	transition: transform 0.3s, box-shadow 0.3s;
}

.mm-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); }

.mm-card > * { margin-block: 0 0.8rem; }

.mm-tag {
	display: inline-block;
	background: var(--wp--preset--color--green);
	color: #fff;
	padding: 0.2rem 0.8rem !important;
	border-radius: 15px;
	font-size: 0.8rem;
	font-weight: 500;
}

.wp-block-button__link { transition: transform 0.3s, box-shadow 0.3s; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.wp-block-button__link:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); }

.mm-btn-discord .wp-block-button__link::before { font-family: "Font Awesome 6 Brands"; content: "\f392"; margin-right: 0.5rem; }
.mm-btn-wiki .wp-block-button__link::before { font-family: "Font Awesome 6 Free"; font-weight: 900; content: "\f518"; margin-right: 0.5rem; }
.mm-btn-gallery .wp-block-button__link::before { font-family: "Font Awesome 6 Free"; font-weight: 900; content: "\f302"; margin-right: 0.5rem; }

/* ---------- Photo sections (cover blocks) ---------- */
.mm-hero { padding: 8rem 2rem 4rem !important; color: #fff; }

.mm-hero h1 { font-size: 3.5rem; text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5); margin-bottom: 1rem; }

.mm-hero p { text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6); margin-bottom: 2rem; }

.mm-on-photo .mm-title,
.mm-on-photo .mm-subtitle,
.mm-on-photo .mm-milestones-title,
.mm-on-photo .mm-milestones-title + p { color: #fff; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }

.mm-on-photo .mm-card { color: var(--wp--preset--color--dark); }

/* ---------- Home ---------- */
.mm-feature { text-align: center; }
.mm-feature p { color: var(--wp--preset--color--muted); }
.mm-feature-icon { color: var(--wp--preset--color--green); font-size: 2rem; margin: 1rem 0 1.5rem !important; }

.mm-banner {
	background: linear-gradient(135deg, var(--wp--preset--color--green), var(--wp--preset--color--green-dark));
	color: #fff;
	padding: 2rem 3rem;
	border-radius: 15px;
	margin-top: 3rem !important;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mm-banner h3 { font-size: 1.5rem; margin: 0; }
.mm-banner p { margin: 0; }

.mm-story { background: rgba(255, 255, 255, 0.95); }
.mm-story h3 { color: var(--wp--preset--color--green); font-size: 1.4rem; font-weight: 600; }
.mm-story p { font-size: 0.95rem; }

.mm-milestones-title { font-size: 2rem; margin-top: 3rem !important; }

.mm-milestone { padding: 1.5rem; gap: 1rem; }
.mm-milestone > * { margin: 0 !important; }
.mm-milestone h4 { font-size: 1.1rem; margin: 0 0 0.3rem; }
.mm-milestone p:not(.mm-tag) { font-size: 0.9rem; color: var(--wp--preset--color--muted); margin: 0 0 0.6rem; }

.mm-milestone-icon {
	background: linear-gradient(135deg, var(--wp--preset--color--green), var(--wp--preset--color--green-dark));
	color: #fff;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.2rem;
	flex-shrink: 0;
}

.mm-photo { padding: 0; overflow: hidden; }
.mm-photo .wp-block-image { margin: 0; }
.mm-photo .wp-block-image img { width: 100%; height: 250px; object-fit: cover; display: block; }
.mm-photo-info { padding: 1.5rem; }
.mm-photo-info > * { margin-block: 0 0.6rem; }
.mm-photo-info h3 { font-size: 1.3rem; font-weight: 600; }
.mm-photo-info p { color: var(--wp--preset--color--muted); font-size: 0.95rem; }
.mm-photo-info .mm-tag { color: #fff; }

.mm-social { gap: 2rem !important; }
.mm-social .wp-social-link { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); transition: transform 0.3s; }
.mm-social .wp-social-link:hover { transform: translateY(-5px) scale(1.05); }
.mm-social .wp-block-social-link-anchor { padding: 0.4em !important; }

/* ---------- Page headers (gallery, wiki guides, other pages) ---------- */
.mm-page-header {
	background: linear-gradient(135deg, var(--wp--preset--color--green) 0%, var(--wp--preset--color--green-dark) 50%, var(--wp--preset--color--orange) 100%);
	color: #fff;
	padding: 8rem 2rem 4rem;
	position: relative;
	overflow: hidden;
}

.mm-page-header::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 12px, transparent 13px) 0 0 / 82px 82px;
	pointer-events: none;
}

.mm-page-header > * { position: relative; }
.mm-page-header h1 { font-size: 3.5rem; text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3); }
.mm-page-header a { color: #fff; }
.mm-crumbs { opacity: 0.9; }

.mm-photo-cat { color: var(--wp--preset--color--green) !important; font-size: 0.85rem !important; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

.mm-date {
	display: inline-block;
	background: var(--wp--preset--color--light);
	color: var(--wp--preset--color--dark) !important;
	padding: 0.3rem 0.8rem;
	border-radius: 15px;
	font-size: 0.85rem !important;
}

.mm-date::before { font-family: "Font Awesome 6 Free"; font-weight: 900; content: "\f133"; color: var(--wp--preset--color--green); margin-right: 0.4rem; }

/* ---------- Wiki ---------- */
.mm-wiki-title::before { font-family: "Font Awesome 6 Free"; font-weight: 900; content: "\f19d"; margin-right: 0.8rem; }

.mm-search { max-width: 900px !important; }
.mm-search .wp-block-search__inside-wrapper { background: #fff; border-radius: 50px; padding: 0.4rem 0.4rem 0.4rem 1.5rem; border: 0; box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); }
.mm-search .wp-block-search__input { border: 0; font-family: inherit; font-size: 1rem; background: transparent; }
.mm-search .wp-block-search__button { border-radius: 50%; width: 42px; height: 42px; padding: 0; margin: 0; display: flex; align-items: center; justify-content: center; }

.mm-pill {
	display: table;
	margin: 0 auto 2rem !important;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	padding: 0.4rem 1.2rem;
	border-radius: 8px;
	font-size: 1.8rem;
}

.mm-category { background: rgba(255, 255, 255, 0.93); padding: 1.5rem; }
.mm-category h3 { font-size: 1.3rem; font-weight: 600; }
.mm-category p { color: var(--wp--preset--color--muted); font-size: 0.95rem; }
.mm-category .mm-explore a { color: var(--wp--preset--color--green); font-weight: 500; text-decoration: none; }

.mm-category-icon {
	width: 48px;
	height: 48px;
	border-radius: 10px;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.2rem;
}

.mm-quickstart { background: linear-gradient(135deg, var(--wp--preset--color--green), var(--wp--preset--color--green-dark)); color: #fff; }
.mm-quickstart h2 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.mm-quickstart p { font-size: 1.1rem; margin-bottom: 2rem; }
.mm-quickstart .is-style-outline .wp-block-button__link { color: #fff; border: 1px solid rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.2); }

/* ---------- Guides (posts) ---------- */
.mm-guide { padding: 1.5rem; height: 100%; }
.mm-guide h3 a { text-decoration: none; color: var(--wp--preset--color--dark); }
.mm-guide h3 a:hover { color: var(--wp--preset--color--green); }
.mm-guide .wp-block-post-excerpt { color: var(--wp--preset--color--muted); font-size: 0.95rem; }
.mm-guide .wp-block-post-excerpt__more-link { color: var(--wp--preset--color--green); font-weight: 500; text-decoration: none; }
.mm-page-header .mm-search { margin-top: 1.5rem; }

.mm-article { max-width: 1040px !important; padding: 2.5rem 3rem; }
.mm-article:hover { transform: none; }
.mm-article img { border-radius: 8px; }
.mm-meta { color: var(--wp--preset--color--muted); font-size: 0.9rem; gap: 0.8rem; }
.mm-article .wp-block-quote { border-left: 4px solid var(--wp--preset--color--green); background: #eef7ee; padding: 1rem 1.25rem; border-radius: 0 8px 8px 0; margin-inline: 0; }
.mm-article .wp-block-quote p { margin: 0; }
.mm-article .wp-block-code { background: #1e2329; color: #e6e6e6; padding: 0.9rem 1.1rem; border-radius: 8px; overflow-x: auto; font-size: 0.9rem; }

/* ---------- Gallery slideshow (Gallery block, "Slideshow" style; see assets/js/slideshow.js) ---------- */
.mm-ss {
	max-width: 100%;
	min-width: 0;
	background: #14181c;
	color: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	outline: none;
}
.mm-ss:focus-visible { box-shadow: 0 0 0 3px var(--wp--preset--color--green); }

.mm-ss-stage {
	position: relative;
	aspect-ratio: 16 / 9;
	max-height: 75vh;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background: #0b0d0f;
}

.mm-ss-image {
	width: 100%;
	height: 100%;
	min-width: 0;
	object-fit: contain;
	cursor: zoom-in;
	transition: opacity 0.35s;
}
.mm-ss-image.is-loading { opacity: 0.25; }

.mm-ss-btn {
	border: 0;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	font-size: 1rem;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}
.mm-ss-btn:hover, .mm-ss-btn:focus-visible { background: var(--wp--preset--color--green); outline: none; }

.mm-ss-prev, .mm-ss-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	background: rgba(0, 0, 0, 0.45);
	font-size: 1.2rem;
}
.mm-ss-prev { left: 1rem; }
.mm-ss-next { right: 1rem; }

.mm-ss-bar { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1.2rem; }
.mm-ss-caption { flex: 1; min-width: 0; font-size: 0.95rem; color: rgba(255, 255, 255, 0.85); }
.mm-ss-caption strong { color: #fff; font-size: 1.05rem; }
.mm-ss-caption a { color: var(--wp--preset--color--green); }
.mm-ss-controls { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.mm-ss-counter { font-size: 0.85rem; color: rgba(255, 255, 255, 0.6); margin-right: 0.4rem; font-variant-numeric: tabular-nums; }

.mm-ss-thumbs {
	position: relative;
	display: flex;
	gap: 0.5rem;
	overflow-x: auto;
	padding: 0 1.2rem 1.2rem;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.mm-ss-thumb {
	flex: 0 0 auto;
	width: 104px;
	height: 66px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 6px;
	overflow: hidden;
	background: #000;
	opacity: 0.55;
	cursor: pointer;
	transition: opacity 0.2s, border-color 0.2s;
}
.mm-ss-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mm-ss-thumb:hover, .mm-ss-thumb:focus-visible { opacity: 0.9; outline: none; }
.mm-ss-thumb.is-active { opacity: 1; border-color: var(--wp--preset--color--green); }

.mm-ss.is-single .mm-ss-prev, .mm-ss.is-single .mm-ss-next, .mm-ss.is-single .mm-ss-play, .mm-ss.is-single .mm-ss-thumbs { display: none; }

/* Full-screen view */
.mm-ss.is-overlay {
	position: fixed;
	inset: 0;
	max-width: none !important;
	margin: 0 !important;
	z-index: 100000;
	border-radius: 0;
	display: flex;
	flex-direction: column;
	background: rgba(8, 10, 12, 0.97);
}
.mm-ss.is-overlay .mm-ss-stage { flex: 1; aspect-ratio: auto; max-height: none; min-height: 0; background: transparent; }
.mm-ss.is-overlay .mm-ss-image { cursor: zoom-out; }
.mm-ss-open, .mm-ss-open body { overflow: hidden; }

/* Without JavaScript (and in the editor) the gallery shows as a normal grid; with it, the slideshow replaces it. */
.wp-block-gallery.is-style-mm-slideshow.has-nested-images figure.wp-block-image:not(#individual-image) {
	flex-grow: 0;
	width: calc(20% - var(--wp--style--unstable-gallery-gap, 16px) * 0.8);
}
.wp-block-gallery.is-style-mm-slideshow.has-nested-images figure.wp-block-image img { height: 150px; object-fit: cover; }
.wp-block-gallery.is-style-mm-slideshow.has-nested-images figure.wp-block-image figcaption { font-size: 0.75rem; }
@media (max-width: 781px) {
	.wp-block-gallery.is-style-mm-slideshow.has-nested-images figure.wp-block-image:not(#individual-image) { width: calc(33.33% - var(--wp--style--unstable-gallery-gap, 16px) * 0.66667); }
}
.wp-block-gallery.mm-ss-source { display: none !important; }

@media (max-width: 781px) {
	.mm-ss-stage { aspect-ratio: 16 / 10; }
	.mm-ss-prev, .mm-ss-next { width: 40px; height: 40px; font-size: 1rem; }
	.mm-ss-prev { left: 0.5rem; }
	.mm-ss-next { right: 0.5rem; }
	.mm-ss-bar { flex-wrap: wrap; }
	.mm-ss-caption { flex-basis: 100%; }
	.mm-ss-controls { margin-left: auto; }
	.mm-ss-thumb { width: 76px; height: 50px; }
}

/* ---------- Footer ---------- */
.mm-footer { background: var(--wp--preset--color--dark); color: rgba(255, 255, 255, 0.6); padding: 3rem 2rem 1.5rem; font-size: 0.9rem; }
.mm-footer a { color: var(--wp--preset--color--green); text-decoration: none; }

/* ---------- Small screens ---------- */
/* Big screens: four guide cards per row instead of three. */
@media (min-width: 1500px) {
	.mm-guides .wp-block-post-template.is-layout-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 781px) {
	.mm-section { padding: 2.5rem 1rem; }
	.mm-page-header { padding: 6rem 1rem 2.5rem; }
	.mm-card { padding: 1.4rem; }
	.mm-article { padding: 1.4rem 1.2rem; }
	.mm-banner { margin-top: 2rem !important; }
	/* The slideshow runs edge to edge on phones. */
	.mm-section .mm-ss { margin-left: -1rem !important; margin-right: -1rem !important; width: calc(100% + 2rem); max-width: none !important; border-radius: 0; }
	.mm-hero h1, .mm-page-header h1 { font-size: 2.4rem; }
	.mm-title { font-size: 2rem; }
	.mm-banner { padding: 2rem; }
	.mm-header { padding: 0.8rem 1rem; }
	.mm-logo-img img { width: 36px !important; height: auto; }
	.mm-hero, .mm-page-header { padding-top: 6rem !important; }
}
