/*
Theme Name: MushroomGrades
Theme URI: https://mushroomgrades.com
Description: Custom theme for MushroomGrades, the functional mushroom supplement rating site. Requires the MushroomGrades Core plugin.
Version: 1.3.0
Requires at least: 6.4
Requires PHP: 7.4
Author: MushroomGrades
Text Domain: mushroomgrades
*/

:root {
	--mg-bg: #F5F6F3;
	--mg-surface: #FFFFFF;
	--mg-ink: #17201B;
	--mg-ink-2: #2C3631;
	--mg-muted: #55605A;
	--mg-line: #E2E5DF;
	--mg-line-2: #EEF0EC;
	--mg-accent: #1F6B4A;
	--mg-accent-dark: #14492F;
	--mg-accent-ink: #1F5C40;
	--mg-accent-soft: #E6F0EA;
	--mg-accent-tint: #F3F7F4;
	--mg-warn: #B45309;
	--mg-warn-bar: #C2690F;
	--mg-warn-ink: #8A4B0B;
	--mg-warn-soft: #FDF1E3;
	--mg-bad: #B42318;
	--mg-placeholder: #EEF1EC;
	--mg-placeholder-line: #B9C2BB;
	--mg-radius: 20px;
	--mg-head: "Space Grotesk", system-ui, sans-serif;
	--mg-body: Inter, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--mg-bg); color: var(--mg-ink); font-family: var(--mg-body); font-size: 16px; line-height: 1.55; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--mg-accent); }
a:hover { color: var(--mg-accent-dark); }
h1, h2, h3 { font-family: var(--mg-head); line-height: 1.15; margin: 0; }
p { margin: 0; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: static; width: auto; height: auto; clip: auto; padding: 8px 12px; background: #fff; }

.mg-wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.mg-main { padding-top: 24px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 28px; }

/* Header */
.mg-header { background: var(--mg-surface); border-bottom: 1px solid var(--mg-line); }
.mg-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.mg-logo { font-family: var(--mg-head); font-weight: 700; font-size: 22px; color: var(--mg-ink); text-decoration: none; }
.mg-logo span { color: var(--mg-accent); }
.mg-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; font-size: 15px; font-weight: 500; }
.mg-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 24px; }
.mg-nav a { color: #3D4842; text-decoration: none; }
.mg-nav a:hover { color: var(--mg-ink); }

/* Buttons */
.mg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; font-weight: 600; font-size: 15px; text-decoration: none; border: 2px solid transparent; cursor: pointer; font-family: inherit; }
.mg-btn--primary { background: var(--mg-accent); color: #fff; }
.mg-btn--primary:hover { background: var(--mg-accent-dark); color: #fff; }
.mg-btn--outline { background: #fff; border-color: var(--mg-accent); color: var(--mg-accent-ink); }
.mg-btn--outline:hover { background: var(--mg-accent-tint); color: var(--mg-accent-ink); }
.mg-btn--light { background: #fff; color: var(--mg-ink); }
.mg-btn--lg { min-height: 48px; padding: 0 22px; border-radius: 12px; font-size: 16px; }
.mg-nav .mg-btn { color: #fff; }

/* Cards and sections */
.mg-card { background: var(--mg-surface); border: 1px solid var(--mg-line); border-radius: var(--mg-radius); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.mg-card--tight { padding: 24px; gap: 12px; }
.mg-card--dark { background: var(--mg-ink); color: #fff; border-color: var(--mg-ink); }
.mg-card--dark p { color: #D6DDD8; }
.mg-h2 { font-size: 26px; }
.mg-h3 { font-size: 20px; }
.mg-small { font-size: 13px; color: var(--mg-muted); }
.mg-meta { font-size: 14px; color: var(--mg-muted); }
.mg-crumbs { font-size: 14px; color: var(--mg-muted); }
.mg-crumbs a { color: var(--mg-muted); }
.mg-row { display: flex; flex-wrap: wrap; gap: 12px; }
.mg-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }

.mg-chip { display: inline-block; padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--mg-line-2); color: #3D4842; text-decoration: none; }
.mg-chip--accent { background: var(--mg-accent-soft); color: var(--mg-accent-ink); }
.mg-chip--warn { background: var(--mg-warn-soft); color: var(--mg-warn-ink); }
a.mg-chip:hover { filter: brightness(0.96); }

.mg-placeholder { background: var(--mg-placeholder); border: 1px dashed var(--mg-placeholder-line); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--mg-muted); font-size: 14px; font-weight: 500; text-align: center; padding: 12px; }
.mg-square { aspect-ratio: 1 / 1; }
.mg-media { border-radius: 16px; overflow: hidden; background: var(--mg-placeholder); }
.mg-media img { width: 100%; height: 100%; object-fit: cover; }

/* Product hero */
.mg-hero { background: var(--mg-surface); border: 1px solid var(--mg-line); border-radius: var(--mg-radius); padding: 32px; display: flex; flex-wrap: wrap; gap: 36px; }
.mg-hero__media { flex: 1 1 300px; max-width: 380px; }
.mg-hero__body { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.mg-hero h1 { font-size: 40px; }
@media (max-width: 600px) { .mg-hero { padding: 20px; } .mg-hero h1 { font-size: 30px; } }

.mg-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; padding: 20px; border-radius: 16px; background: var(--mg-accent-tint); border: 1px solid #D5E3DA; }
.mg-verdict--warn { background: #FFF8EF; border-color: #F1D9B8; }
.mg-verdict__body { flex: 1 1 260px; display: flex; flex-direction: column; gap: 6px; }
.mg-verdict__label { font-family: var(--mg-head); font-size: 22px; font-weight: 700; color: var(--mg-accent-ink); }
.mg-verdict--warn .mg-verdict__label { color: var(--mg-warn-ink); }
.mg-verdict p { font-size: 16px; color: var(--mg-ink-2); }

.mg-ring { width: 112px; height: 112px; border-radius: 50%; border: 10px solid var(--mg-accent); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; }
.mg-ring--warn { border-color: var(--mg-warn-bar); }
.mg-ring--bad { border-color: var(--mg-bad); }
.mg-ring__num { font-family: var(--mg-head); font-size: 34px; font-weight: 700; line-height: 1; }
.mg-ring__of { font-size: 12px; color: var(--mg-muted); }

.mg-grade { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--mg-accent); color: #fff; font-family: var(--mg-head); font-weight: 700; font-size: 16px; }
.mg-grade--warn { background: var(--mg-warn-bar); }
.mg-grade--bad { background: var(--mg-bad); }

/* Layout with sidebar */
.mg-split { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.mg-split__main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.mg-split__side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* Score bars */
.mg-bar { display: flex; flex-direction: column; gap: 6px; }
.mg-bar__head { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.mg-bar__head span:first-child { font-weight: 600; }
.mg-bar__head span:last-child { font-weight: 700; }
.mg-bar__track { height: 10px; border-radius: 999px; background: #E7EBE6; overflow: hidden; }
.mg-bar__fill { height: 10px; border-radius: 999px; background: var(--mg-accent); }
.mg-bar--warn .mg-bar__fill { background: var(--mg-warn-bar); }
.mg-bar--warn .mg-bar__head span:last-child { color: var(--mg-warn-ink); }

/* Pros and cons */
.mg-two { display: flex; flex-wrap: wrap; gap: 20px; }
.mg-two > * { flex: 1 1 260px; }
.mg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.mg-list li { display: flex; gap: 10px; font-size: 15px; }
.mg-list svg { flex: none; margin-top: 2px; }
.mg-good-title { color: var(--mg-accent-ink); font-size: 22px; }
.mg-warn-title { color: var(--mg-warn-ink); font-size: 22px; }

/* Label notes */
.mg-label { display: flex; flex-wrap: wrap; gap: 24px; }
.mg-label__img { flex: 1 1 240px; min-height: 280px; }
.mg-label ol { flex: 1 1 280px; margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 14px; font-size: 15px; }

/* Facts */
.mg-facts { display: flex; flex-direction: column; }
.mg-fact { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--mg-line-2); font-size: 14px; }
.mg-fact:last-child { border-bottom: 0; }
.mg-fact dt { color: var(--mg-muted); }
.mg-fact dd { margin: 0; font-weight: 600; text-align: right; }
.mg-fact dd.is-warn { color: var(--mg-warn-ink); }

/* Product cards */
.mg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.mg-pcard { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 16px; border: 1px solid var(--mg-line); background: #fff; text-decoration: none; color: var(--mg-ink); }
.mg-pcard:hover { border-color: var(--mg-accent); color: var(--mg-ink); }
.mg-pcard__img { aspect-ratio: 4 / 3; border-radius: 10px; }
.mg-pcard__name { font-weight: 600; font-size: 16px; }
.mg-pcard__badge { font-size: 14px; color: var(--mg-muted); }
.mg-pcard__score { display: flex; align-items: center; gap: 8px; }
.mg-pill { padding: 4px 10px; border-radius: 8px; background: var(--mg-accent-soft); color: var(--mg-accent-ink); font-weight: 700; font-size: 15px; }
.mg-pill--warn { background: var(--mg-warn-soft); color: var(--mg-warn-ink); }
.mg-pill--bad { background: #FDE8E6; color: #8F1D14; }

/* FAQ */
.mg-faq details { border-top: 1px solid var(--mg-line); padding: 14px 0; }
.mg-faq details:last-child { border-bottom: 1px solid var(--mg-line); }
.mg-faq summary { font-weight: 600; font-size: 16px; cursor: pointer; min-height: 28px; }
.mg-faq details p { margin-top: 10px; font-size: 15px; color: var(--mg-ink-2); line-height: 1.6; }

/* Forms */
.mg-field { display: flex; flex-direction: column; gap: 6px; }
.mg-field label { font-size: 14px; font-weight: 600; }
.mg-input { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--mg-placeholder-line); font-size: 15px; font-family: inherit; }

/* Home */
.mg-homehero { background: var(--mg-surface); border: 1px solid var(--mg-line); border-radius: var(--mg-radius); padding: 48px 32px; display: flex; flex-direction: column; gap: 18px; }
.mg-homehero h1 { font-size: 48px; max-width: 760px; }
.mg-homehero p { font-size: 18px; color: var(--mg-ink-2); max-width: 680px; }
@media (max-width: 600px) { .mg-homehero { padding: 28px 20px; } .mg-homehero h1 { font-size: 34px; } }

/* Generic content */
.mg-content { font-size: 17px; line-height: 1.7; }
.mg-content > * + * { margin-top: 1em; }
.mg-content h2 { font-size: 28px; margin-top: 1.4em; }
.mg-content h3 { font-size: 22px; margin-top: 1.2em; }

/* Footer */
.mg-footer { background: var(--mg-surface); border-top: 1px solid var(--mg-line); }
.mg-footer__inner { padding-top: 28px; padding-bottom: 28px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--mg-muted); }
.mg-footer a { color: var(--mg-muted); }
.mg-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; }

.mg-pagination { display: flex; gap: 8px; flex-wrap: wrap; }
.mg-pagination .page-numbers { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--mg-line); background: #fff; text-decoration: none; }
.mg-pagination .current { background: var(--mg-accent); color: #fff; border-color: var(--mg-accent); }

/* Low-score products (grades D and F) */
.mg-lowscore { padding: 12px 16px; border-radius: 12px; background: var(--mg-warn-soft); color: var(--mg-warn-ink); font-weight: 600; font-size: 15px; }
.mg-lowscore a { color: var(--mg-warn-ink); }
.mg-card--highlight { border: 2px solid var(--mg-accent); }

/* Tables and lists in page content */
.mg-content table { width: 100%; border-collapse: collapse; font-size: 15px; }
.mg-content th, .mg-content td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--mg-line); vertical-align: top; }
.mg-content th { background: var(--mg-accent-tint); font-weight: 600; }
.mg-content figure.wp-block-table { margin: 1em 0; overflow-x: auto; }
.mg-content ul, .mg-content ol { padding-left: 22px; }
.mg-content li + li { margin-top: 6px; }
.mg-content .mg-note { padding: 12px 16px; border-radius: 12px; background: var(--mg-warn-soft); color: var(--mg-warn-ink); font-size: 15px; }

/* Country switch */
.mg-country { display: inline-flex; border: 1px solid var(--mg-line); border-radius: 10px; overflow: hidden; }
.mg-country__btn { min-height: 44px; min-width: 44px; padding: 0 12px; border: 0; background: #fff; color: #3D4842; font: 600 14px var(--mg-body); cursor: pointer; }
.mg-country__btn + .mg-country__btn { border-left: 1px solid var(--mg-line); }
.mg-country__btn[aria-pressed="true"] { background: var(--mg-accent); color: #fff; }
.mg-buy { display: flex; flex-direction: column; gap: 10px; }
.mg-buy:empty { display: none; }
.mg-unavailable { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.mg-unavailable .mg-pcard { opacity: 0.75; }
.mg-pcard__badge--auto { font-weight: 600; color: var(--mg-accent-ink); }
