/*
Theme Name: MSB Agro
Theme URI: https://msbagrofarm.com
Author: MSB Agro Farm and Livestock
Description: Custom block theme for MSB Agro Farm and Livestock — goatery, duckery, fishery and exotic plants.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
Version: 1.0.4
License: GPL-2.0-or-later
Text Domain: msb-agro
*/

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { height: auto; }
:where(a) { text-underline-offset: .18em; text-decoration-thickness: 1px; }
::selection { background: var(--wp--preset--color--leaf); color: var(--wp--preset--color--forest); }
:focus-visible { outline: 3px solid var(--wp--preset--color--gold); outline-offset: 2px; }

/* ---------- Header ---------- */
.msb-header {
	position: sticky; top: 0; z-index: 50;
	background: transparent !important;
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--forest) 10%, transparent);
}
/* Blur lives on a pseudo-element: backdrop-filter on the header itself would
   trap the fixed-position mobile menu overlay inside the header bar. */
.msb-header::before {
	content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
	background: color-mix(in srgb, var(--wp--preset--color--cream) 88%, transparent);
	backdrop-filter: saturate(160%) blur(10px);
	-webkit-backdrop-filter: saturate(160%) blur(10px);
}
.admin-bar .msb-header { top: var(--wp-admin--admin-bar--height, 32px); }
.msb-header .wp-block-site-logo img { border-radius: 50%; }
.msb-header .wp-block-site-title { line-height: 1.1; }
.msb-header .wp-block-site-title a { text-decoration: none; }
.msb-header .wp-block-navigation .wp-block-navigation-item__content { padding: .35em .1em; }
.msb-header .wp-block-navigation a:hover { color: var(--wp--preset--color--green); }
.msb-header .wp-block-navigation__submenu-container {
	border-radius: 12px; border: 1px solid var(--wp--preset--color--line) !important;
	box-shadow: 0 18px 40px -18px rgba(23,59,42,.35); padding: .4rem !important; min-width: 220px !important;
}
.msb-header .wp-block-navigation__submenu-container a { padding: .55rem .8rem !important; border-radius: 8px; }
.msb-header .wp-block-navigation__submenu-container a:hover { background: var(--wp--preset--color--leaf); }
/* Mobile menu overlay */
.msb-header .wp-block-navigation__responsive-container.is-menu-open { padding: 1.25rem 1.5rem 2rem; }
.msb-header .is-menu-open .wp-block-navigation__responsive-container-content { padding-top: 3.5rem !important; align-items: flex-start !important; }
.msb-header .is-menu-open .wp-block-navigation__container,
.msb-header .is-menu-open .wp-block-navigation-item { align-items: flex-start !important; width: 100%; }
.msb-header .is-menu-open .wp-block-navigation__container { gap: 0 !important; }
.msb-header .is-menu-open .wp-block-navigation__container > .wp-block-navigation-item { border-bottom: 1px solid var(--wp--preset--color--line); padding: .8rem 0; }
.msb-header .is-menu-open .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	font-family: var(--wp--preset--font-family--display); font-size: 1.4rem; font-weight: 600; color: var(--wp--preset--color--forest);
}
.msb-header .is-menu-open .wp-block-navigation__submenu-container {
	border: 0 !important; box-shadow: none; padding: .4rem 0 0 .9rem !important; min-width: 0 !important; gap: 0 !important;
	border-left: 2px solid var(--wp--preset--color--gold) !important; margin-top: .5rem;
}
.msb-header .is-menu-open .wp-block-navigation__submenu-container a { padding: .4rem .2rem !important; font-size: 1.05rem; color: var(--wp--preset--color--muted); }
.msb-header .is-menu-open .wp-block-navigation__responsive-container-close { top: 1.25rem; right: 1.25rem; }
.msb-header .is-menu-open .wp-block-navigation__responsive-container-close svg { width: 30px; height: 30px; }
.msb-header .wp-block-navigation__responsive-container-open svg { width: 28px; height: 28px; }
@media (max-width: 781px) {
	.msb-header .msb-header-cta { display: none; }
	.msb-brand-sub { display: none; }
}

/* ---------- Hero ---------- */
.msb-hero { min-height: min(88vh, 760px) !important; }
.msb-hero h1 { text-wrap: balance; }
.msb-eyebrow {
	display: inline-flex; align-items: center; gap: .5rem;
	letter-spacing: .14em; text-transform: uppercase; font-size: .78rem !important; font-weight: 600;
}
.msb-eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--wp--preset--color--gold); display: inline-block; }
.msb-pill {
	display: inline-block; padding: .35rem .85rem; border-radius: 999px;
	background: color-mix(in srgb, var(--wp--preset--color--cream) 18%, transparent);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--cream) 35%, transparent);
	backdrop-filter: blur(6px);
}

/* ---------- Cards ---------- */
.msb-card {
	border-radius: 18px; overflow: hidden; background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--line);
	transition: transform .25s ease, box-shadow .25s ease;
}
.msb-grid .msb-card, .wp-block-post-template .msb-card { height: 100%; }
.msb-card:hover { transform: translateY(-4px); box-shadow: 0 24px 48px -24px rgba(23,59,42,.35); }
.msb-card .wp-block-image, .msb-card .wp-block-post-featured-image { margin: 0 !important; overflow: hidden; }
.msb-card .wp-block-image img, .msb-card .wp-block-post-featured-image img {
	aspect-ratio: 4/3; object-fit: cover; width: 100%; transition: transform .6s ease;
}
.msb-card:hover .wp-block-image img, .msb-card:hover .wp-block-post-featured-image img { transform: scale(1.05); }
.msb-card a { text-decoration: none; }
.msb-card .wp-block-post-title a:hover, .msb-card h3 a:hover { color: var(--wp--preset--color--green); }
.wp-block-post-template.is-layout-grid > li, .msb-grid > .wp-block-column { display: flex; }
.wp-block-post-template > li > .msb-card { width: 100%; }

.msb-link-arrow a::after, a.msb-link-arrow::after { content: " →"; transition: margin .2s; }
.msb-link-arrow a:hover::after { margin-left: .25rem; }

.msb-icon {
	width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
	background: var(--wp--preset--color--leaf); font-size: 1.6rem; line-height: 1;
	margin-left: 0 !important;
}

/* ---------- Stats ---------- */
.msb-stat .msb-stat-num { font-family: var(--wp--preset--font-family--display); line-height: 1; }
.msb-stats > .wp-block-column { border-left: 1px solid color-mix(in srgb, var(--wp--preset--color--cream) 25%, transparent); padding-left: 1.25rem; }
@media (max-width: 781px) {
	.msb-stats { gap: 1.5rem 1rem !important; }
	.msb-stats > .wp-block-column { flex-basis: calc(50% - .5rem) !important; border-left: 0; padding-left: 0; }
	.msb-stats .msb-stat-num { font-size: 2.1rem !important; }
}

/* ---------- Media ---------- */
.msb-rounded img, .msb-rounded.wp-block-cover { border-radius: 22px; }
.msb-img-stack { position: relative; }
.msb-badge-float {
	position: absolute; bottom: -18px; left: -18px; max-width: 220px;
	border-radius: 16px; box-shadow: 0 20px 40px -20px rgba(23,59,42,.5);
}
@media (max-width: 781px) { .msb-badge-float { position: static; margin-top: 1rem !important; max-width: none; } }

.msb-check { list-style: none; padding-left: 0 !important; }
.msb-check li { position: relative; padding-left: 1.9rem; margin-bottom: .7rem; }
.msb-check li::before {
	content: "✓"; position: absolute; left: 0; top: .1em; width: 1.3rem; height: 1.3rem; border-radius: 50%;
	background: var(--wp--preset--color--green); color: #fff; font-size: .75rem; display: grid; place-items: center; font-weight: 700;
}

/* ---------- Projects ---------- */
.msb-facts { border-radius: 18px; border: 1px solid var(--wp--preset--color--line); background: var(--wp--preset--color--white); overflow: hidden; }
.msb-facts dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.msb-facts dl > div { padding: 1rem 1.25rem; border-bottom: 1px solid var(--wp--preset--color--line); border-right: 1px solid var(--wp--preset--color--line); }
.msb-facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--wp--preset--color--muted); margin-bottom: .25rem; }
.msb-facts dd { margin: 0; font-weight: 600; color: var(--wp--preset--color--forest); }
.msb-status { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .3rem .7rem; border-radius: 999px; background: var(--wp--preset--color--leaf); color: var(--wp--preset--color--green); }
.msb-status--applied { background: #FFF4DB; color: #8A5A00; }
.msb-status--sanctioned, .msb-status--ongoing { background: #E3EEFF; color: #1D4E9E; }
.msb-status--completed { background: var(--wp--preset--color--leaf); color: var(--wp--preset--color--green); }
.msb-meta-line { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- Contact form ---------- */
.msb-form { display: grid; gap: 1rem; }
.msb-form .msb-row { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .msb-form .msb-row { grid-template-columns: 1fr; } }
.msb-form label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--wp--preset--color--forest); }
.msb-form input, .msb-form select, .msb-form textarea {
	width: 100%; box-sizing: border-box; font: inherit; padding: .8rem 1rem; border-radius: 12px;
	border: 1px solid var(--wp--preset--color--line); background: var(--wp--preset--color--white); color: var(--wp--preset--color--ink);
}
.msb-form input:focus, .msb-form select:focus, .msb-form textarea:focus { outline: 2px solid var(--wp--preset--color--green); border-color: transparent; }
.msb-form button {
	justify-self: start; cursor: pointer; border: 0; border-radius: 999px; padding: .9rem 1.8rem; font: inherit; font-weight: 600;
	background: var(--wp--preset--color--green); color: #fff;
}
.msb-form button:hover { background: var(--wp--preset--color--forest); }
.msb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.msb-notice { padding: 1rem 1.25rem; border-radius: 12px; font-weight: 500; }
.msb-notice--ok { background: var(--wp--preset--color--leaf); color: var(--wp--preset--color--forest); }
.msb-notice--err { background: #FDECEA; color: #8C1D18; }

/* ---------- Footer ---------- */
.msb-footer .wp-block-list a { white-space: nowrap; }
.msb-footer a { text-decoration: none; }
.msb-footer a:hover { color: var(--wp--preset--color--gold) !important; }
.msb-footer .wp-block-navigation { gap: .55rem; }
.msb-footer .wp-block-site-logo img { border-radius: 50%; background: var(--wp--preset--color--cream); }
.msb-divider-gold { height: 3px; border: 0; background: linear-gradient(90deg, var(--wp--preset--color--gold), transparent); }

/* ---------- Floating WhatsApp ---------- */
.msb-wa {
	position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 56px; height: 56px; border-radius: 50%;
	background: #25D366; color: #fff; display: grid; place-items: center; box-shadow: 0 12px 28px -8px rgba(0,0,0,.35);
	transition: transform .2s;
}
.msb-wa:hover { transform: scale(1.06); }
.msb-wa svg { width: 30px; height: 30px; fill: currentColor; }

/* ---------- Reveal on scroll ---------- */
@media (prefers-reduced-motion: no-preference) {
	.msb-js .msb-reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
	.msb-js .msb-reveal.is-visible { opacity: 1; transform: none; }
}

/* ---------- Misc ---------- */
.wp-block-post-content > .alignfull:first-child { margin-top: 0; }
.msb-page-hero { position: relative; overflow: hidden; }
.msb-page-hero::after {
	content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%;
	background: radial-gradient(circle, color-mix(in srgb, var(--wp--preset--color--gold) 35%, transparent), transparent 70%);
	pointer-events: none;
}
.wp-block-query-pagination { gap: .5rem; }
.wp-block-query-pagination-numbers .page-numbers { padding: .4rem .8rem; border-radius: 8px; }
.wp-block-query-pagination-numbers .current { background: var(--wp--preset--color--green); color: #fff; }

/* Hide the floating WhatsApp button while the mobile menu is open. */
html.has-modal-open .msb-wa { display: none; }
