/*
Theme Name:   Moneywise
Theme URI:    https://moneywisecircle.com
Description:  The Moneywise theme. Deliberately small: header, footer, type and the four brand colours, and nothing else. Pages carry their own layout, the way the homepage already does. No page builder, no icon font, no jQuery, no course plugin. Built against the Brand Guidelines v1.0.
Author:       Moneywise
Author URI:   https://moneywisecircle.com
Version:      1.1.0
Requires at least: 6.4
Requires PHP: 8.0
License:      GPL-2.0-or-later
Text Domain:  moneywise
*/

/* ---------------------------------------------------------------------------
   Design tokens. Taken from the live homepage, which is the approved design,
   and checked against Brand Guidelines v1.0:
   Brand Green #2C5410, Lime #84C234, White #FFFFFF, Near black #0F0F0F.
   Change a colour here and it changes everywhere.
--------------------------------------------------------------------------- */
:root {
	--green:        #2C5410;
	--green-deep:   #1E3B0B;
	--green-deeper: #0E2004;
	--lime:         #84C234;
	--lime-soft:    #9FD24E;
	--lime-tint:    #EAF3D9;
	--gold:         #C9A24C;
	--gold-soft:    #E1C074;
	--ink:          #0F0F0F;
	--ink2:         #4A573C;
	--ink3:         #727E64;
	--paper:        #F7F9F1;
	--card:         #FFFFFF;
	--line:         #E4EAD7;
	--line2:        #EEF2E6;
	--white:        #FFFFFF;

	--wrap:  1220px;
	--brand: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;

	/* One typeface, four weights. Brand Guidelines, Typography. */
	--w-regular: 400;
	--w-medium:  500;
	--w-bold:    700;
	--w-black:   800;
}

/* ---------------------------------------------------------------------------
   Reset. Short on purpose. Elementor's frontend.css supplies a reset on pages
   that use it, but a theme cannot rely on that, so we set our own.
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--brand);
	font-weight: var(--w-regular);
	font-size: 1rem;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}
img, picture, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.1; font-weight: var(--w-black); letter-spacing: -0.02em; }
p { margin: 0 0 1em; }

/* Type scale. Clamped so one rule covers phone to desktop. */
h1 { font-size: clamp(2.1rem, 1.2rem + 3.6vw, 4rem); }
h2 { font-size: clamp(1.7rem, 1.1rem + 2.2vw, 2.8rem); }
h3 { font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem); }

/* Visible focus. Never remove this: it is how keyboard users navigate. */
:where(a, button, input, select, textarea):focus-visible {
	outline: 3px solid var(--lime);
	outline-offset: 2px;
	border-radius: 4px;
}

.mw-wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
.mw-skip {
	position: absolute; left: -9999px; top: 0; z-index: 999;
	background: var(--green); color: var(--white); padding: 12px 18px; border-radius: 0 0 10px 0;
}
.mw-skip:focus { left: 0; }

/* ---------------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------------- */
.mw-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 9px;
	font-weight: var(--w-bold); font-size: 1rem;
	padding: 15px 28px; border-radius: 12px; border: 0; cursor: pointer;
	transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.mw-btn-primary {
	background: var(--lime); color: var(--green-deeper);
	box-shadow: 0 12px 26px -10px rgba(132, 194, 52, .7);
}
.mw-btn-primary:hover { background: var(--lime-soft); transform: translateY(-1px); }
.mw-btn-quiet { background: transparent; color: var(--green); border: 1.5px solid var(--line); }
.mw-btn-quiet:hover { border-color: var(--green); }

/* ---------------------------------------------------------------------------
   Header
--------------------------------------------------------------------------- */
.mw-head {
	position: sticky; top: 0; z-index: 120;
	background: rgba(247, 249, 241, .97);
	backdrop-filter: saturate(140%) blur(8px);
	border-bottom: 1px solid transparent;
	transition: border-color .3s ease, box-shadow .3s ease;
}
.mw-head.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 24px -18px rgba(14, 32, 4, .5); }
.mw-head-in { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 88px; }
.mw-brand { display: inline-flex; align-items: center; }
.mw-brand img { width: auto; height: 34px; }
.mw-nav { display: flex; align-items: center; gap: 30px; }
.mw-nav a { font-weight: var(--w-medium); color: var(--ink2); }
.mw-nav a:hover, .mw-nav .current-menu-item > a { color: var(--green); }
.mw-nav ul { list-style: none; display: flex; align-items: center; gap: 30px; margin: 0; padding: 0; }

.mw-burger { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.mw-burger span { display: block; width: 24px; height: 2px; background: var(--ink); border-radius: 2px; }
.mw-burger span + span { margin-top: 6px; }

@media (max-width: 900px) {
	.mw-nav { display: none; }
	.mw-burger { display: block; }
	.mw-head-in { height: 72px; }
	.mw-nav.is-open {
		display: flex; flex-direction: column; align-items: flex-start; gap: 18px;
		position: absolute; left: 0; right: 0; top: 72px;
		background: var(--paper); border-bottom: 1px solid var(--line); padding: 22px 28px;
	}
	.mw-nav.is-open ul { flex-direction: column; align-items: flex-start; gap: 18px; }

	/* Dim the page behind the open menu, so a half covered line of body text
	   never reads as a rendering fault. Sits under the header, over the page. */
	body.mw-menu-open::after {
		content: '';
		position: fixed; inset: 0; z-index: 110;
		background: rgba(14, 32, 4, .38);
	}
}

/* ---------------------------------------------------------------------------
   Footer
--------------------------------------------------------------------------- */
.mw-foot { background: var(--green-deeper); color: rgba(255, 255, 255, .72); padding: 52px 0 32px; }
.mw-foot a { color: rgba(255, 255, 255, .72); }
.mw-foot a:hover { color: var(--white); }
/* Flexbox, not grid. The number of footer columns depends on how many menus
   are assigned, and a fixed grid count drops the extra one onto its own row.
   Note that repeat(auto-fit) cannot be mixed with fr tracks: that is invalid
   CSS and collapses the whole footer to a single column. */
.mw-foot-grid { display: flex; flex-wrap: wrap; gap: 36px 48px; }
.mw-foot-brand { flex: 1 1 280px; max-width: 380px; }
.mw-foot-col { flex: 1 1 150px; }
.mw-foot-brand img { height: 30px; width: auto; }
.mw-foot-tag { margin: 16px 0 20px; max-width: 34ch; }
.mw-foot h2 { color: var(--white); font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; font-weight: var(--w-bold); margin-bottom: 14px; }
.mw-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mw-foot-bottom {
	margin-top: 40px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .12);
	display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; font-size: .86rem;
}
.mw-foot-bottom ul { display: flex; flex-wrap: wrap; gap: 22px; }
@media (max-width: 560px) { .mw-foot-brand, .mw-foot-col { flex-basis: 100%; } }

/* ---------------------------------------------------------------------------
   Page body. Only used by pages that do not bring their own layout.
--------------------------------------------------------------------------- */
.mw-page { padding: 56px 0 72px; }
.mw-page-title { margin-bottom: 28px; }
.mw-prose { max-width: 70ch; }
.mw-prose h2, .mw-prose h3 { margin-top: 1.6em; }
.mw-prose ul, .mw-prose ol { padding-left: 1.2em; }
.mw-prose a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------------------------
   Store links in the footer
--------------------------------------------------------------------------- */
.mw-store { display: flex; flex-wrap: wrap; gap: 10px; }
.mw-store-link {
	display: inline-flex; align-items: center;
	padding: 11px 18px; border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, .22);
	font-weight: var(--w-medium); font-size: .92rem;
	color: var(--white);
	transition: border-color .2s ease, background .2s ease;
}
.mw-store-link:hover { border-color: var(--lime); background: rgba(132, 194, 52, .14); color: var(--white); }

/* ---------------------------------------------------------------------------
   Post list. Used by the blog index, archives and search results.
--------------------------------------------------------------------------- */
.mw-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 28px; }
.mw-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; padding-bottom: 20px; }
.mw-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.mw-card h2 { font-size: 1.18rem; margin: 20px 20px 8px; }
.mw-card h2 a:hover { color: var(--green); }
.mw-card p { margin: 0 20px; color: var(--ink3); font-size: .95rem; }

.mw-meta { color: var(--ink3); font-size: .9rem; margin-top: -.4em; }
.mw-hero-img { margin: 0 0 30px; }
.mw-hero-img img { border-radius: 16px; }

.pagination { margin-top: 44px; display: flex; justify-content: center; }
.pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 42px; height: 42px; padding: 0 12px;
	border: 1px solid var(--line); border-radius: 10px;
	font-weight: var(--w-medium);
}
.pagination .page-numbers:hover { border-color: var(--green); }
.pagination .page-numbers.current { background: var(--green); border-color: var(--green); color: var(--white); }

.search-form { display: flex; gap: 10px; margin: 20px 0 28px; flex-wrap: wrap; }
.search-form label { flex: 1 1 220px; }
.search-form .search-field {
	width: 100%; padding: 14px 16px;
	border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.search-form .search-submit {
	background: var(--green); color: var(--white); border: 0;
	padding: 14px 24px; border-radius: 12px; font-weight: var(--w-bold); cursor: pointer;
}
