/*
Theme Name: B4 Bonsai
Theme URI: https://b4bonsai.com
Author: B4 Bonsai
Author URI: https://b4bonsai.com
Description: A custom Japanese bonsai / zen-inspired WordPress theme for b4bonsai.com. Fully customizable via the WordPress Customizer, mobile-first responsive, AdSense-optimized and built for Core Web Vitals.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: b4bonsai
Tags: blog, one-column, two-columns, right-sidebar, custom-colors, custom-logo, custom-menu, featured-images, sticky-post, threaded-comments, translation-ready, dark-mode

B4 Bonsai WordPress Theme is distributed under the terms of the GNU GPL v2 or later.
*/

/* =========================================================
   0. CSS RESET
   ========================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; max-width: 100%; }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { list-style: none; margin: 0; padding: 0; }
img, picture, svg { max-width: 100%; display: block; }
input, button, textarea, select { font: inherit; color: inherit; }
a { text-decoration: none; color: inherit; }
table { border-collapse: collapse; width: 100%; }

/* =========================================================
   1. CUSTOM PROPERTIES (fallback values — overridden by
      Customizer inline styles in inc/customizer-output.php)
   ========================================================= */
:root {
	/* light palette */
	--b4-base: #F7F3EA;
	--b4-surface: #FFFFFF;
	--b4-primary: #3B5B45;
	--b4-secondary: #4A6741;
	--b4-accent: #B85C38;
	--b4-text: #2B2825;
	--b4-highlight: #C9A961;
	--b4-border: rgba(43, 40, 37, 0.12);
	--b4-header-bg: rgba(247, 243, 234, 0.92);
	--b4-hero-glow: rgba(59, 91, 69, 0.12);
	--b4-cat-color-bg-default: rgba(59, 91, 69, 0.15);

	/* type */
	--b4-font-heading: "Shippori Mincho", "Noto Serif JP", serif;
	--b4-font-body: "Zen Kaku Gothic New", "Noto Sans", "Noto Sans Devanagari", sans-serif;
	--b4-font-size-base: 1rem;

	/* rhythm */
	--b4-radius: 22px;
	--b4-radius-sm: 10px;
	--b4-gap: clamp(1.25rem, 3vw, 2.5rem);
	--b4-container: 1240px;
	--b4-header-h: 76px;

	color-scheme: light;
}

[data-theme="dark"] {
	--b4-base: #1E211C;
	--b4-surface: #262A23;
	--b4-primary: #7FA588;
	--b4-secondary: #8FAE81;
	--b4-accent: #D98A63;
	--b4-text: #EDE8DC;
	--b4-highlight: #DCC17F;
	--b4-border: rgba(237, 232, 220, 0.14);
	--b4-header-bg: rgba(30, 33, 28, 0.92);
	--b4-hero-glow: rgba(127, 165, 136, 0.14);
	color-scheme: dark;
}

/* =========================================================
   2. BASE / TYPOGRAPHY
   ========================================================= */
html { font-size: 100%; }

body {
	/* !important on these two: page builders/plugins (Elementor's Site
	   Settings > Background is a common one) ship their own generic
	   `body { background-color: ...; }` rule targeting the same element
	   at equal specificity, which wins on load order alone and silently
	   overrides the theme's background — leaving dark-mode text stranded
	   on a light background. The theme owns this via its own dedicated
	   Customizer color settings, so it's kept from being clobbered. */
	background-color: var(--b4-base) !important;
	color: var(--b4-text) !important;
	font-family: var(--b4-font-body);
	font-size: var(--b4-font-size-base);
	line-height: 1.75;
	font-feature-settings: "palt";
	overflow-x: hidden;
	transition: background-color .35s ease, color .35s ease;
}

body.has-texture { background-image: var(--b4-texture, none); background-repeat: repeat; }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--b4-font-heading);
	color: var(--b4-text);
	line-height: 1.35;
	font-weight: 600;
	letter-spacing: .01em;
	overflow-wrap: break-word;
	word-break: break-word;
	text-wrap: balance;
}

h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 1rem + .8vw, 1.6rem); }
h4 { font-size: clamp(1.05rem, .95rem + .4vw, 1.25rem); }
p, li, dd { overflow-wrap: break-word; word-break: break-word; }
a { transition: color .25s ease; }

.b4-container {
	width: 100%;
	max-width: var(--b4-container);
	margin-inline: auto;
	padding-inline: clamp(1.1rem, 4vw, 2rem);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px,1px,1px,1px);
	white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip-link {
	position: fixed; top: -100px; left: 1rem; z-index: 10000;
	background: var(--b4-primary); color: #fff; padding: .75rem 1.25rem;
	border-radius: var(--b4-radius-sm); transition: top .2s ease;
}
.skip-link:focus { top: 1rem; }

::selection { background: var(--b4-highlight); color: var(--b4-text); }

/* =========================================================
   3. BONSAI MOTIFS
   ========================================================= */
.b4-icon { width: 1.35em; height: 1.35em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.28em; }

.b4-divider {
	display: flex; align-items: center; justify-content: center;
	gap: .85rem; color: var(--b4-secondary); opacity: .8;
	margin: clamp(2rem, 5vw, 3.5rem) 0;
}
.b4-divider::before, .b4-divider::after {
	content: ""; flex: 1 1 0; height: 1px;
	background: linear-gradient(90deg, transparent, var(--b4-border) 50%, transparent);
}
.b4-divider .b4-icon { width: 1.6em; height: 1.6em; opacity: .85; }

/* pot-shaped media frame */
.b4-pot-frame {
	position: relative;
	border-radius: var(--b4-radius) var(--b4-radius) 46% 46% / var(--b4-radius) var(--b4-radius) 30% 30%;
	overflow: hidden;
	background: var(--b4-surface);
	box-shadow: 0 18px 40px -22px rgba(43,40,37,.35);
}
.b4-pot-frame img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; }

/* Ensō progress ring */
.b4-enso-progress {
	position: fixed; right: clamp(14px, 3vw, 30px); bottom: clamp(14px, 3vw, 30px);
	width: 52px; height: 52px; z-index: 900; opacity: 0; pointer-events: none;
	transition: opacity .3s ease;
}
.b4-enso-progress.is-visible { opacity: 1; pointer-events: auto; }
.b4-enso-progress svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.b4-enso-progress circle { fill: none; stroke-linecap: round; }
.b4-enso-progress .b4-enso-track { stroke: var(--b4-border); stroke-width: 4; }
.b4-enso-progress .b4-enso-bar { stroke: var(--b4-accent); stroke-width: 4; stroke-dasharray: 150.8; stroke-dashoffset: 150.8; transition: stroke-dashoffset .12s linear; }
.b4-enso-progress button {
	position: absolute; inset: 8px; border-radius: 50%; border: 0; background: var(--b4-surface);
	color: var(--b4-primary); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.b4-enso-progress .b4-icon { width: 1.1em; height: 1.1em; }
.b4-icon-rotate-up { transform: rotate(-90deg); }

/* =========================================================
   4. SCROLL-IN ANIMATIONS (CSS only)
   ========================================================= */
.b4-reveal {
	opacity: 0; transform: translateY(22px) scale(.98);
	transition: opacity .7s cubic-bezier(.22,.61,.36,1), transform .7s cubic-bezier(.22,.61,.36,1);
	/* Safety net: if JS is delayed/blocked (some cache/optimization
	   plugins defer all scripts until user interaction), this guarantees
	   the content still appears on its own after a short wait instead of
	   staying invisible forever. When JS runs normally it reveals well
	   before this fires, via .is-visible below, and cancels it. */
	animation: b4-reveal-fallback 0.01ms 1.2s forwards;
}
@keyframes b4-reveal-fallback {
	to { opacity: 1; transform: none; }
}
.b4-reveal.is-visible { opacity: 1; transform: none; animation: none; }
.js .b4-reveal { will-change: opacity, transform; }
.no-js .b4-reveal { opacity: 1; transform: none; animation: none; }

/* =========================================================
   5. HEADER
   ========================================================= */
.site-header {
	background: var(--b4-header-bg);
	backdrop-filter: saturate(140%) blur(10px);
	border-bottom: 1px solid var(--b4-border);
	position: relative; z-index: 500;
}
.site-header.is-sticky { position: sticky; top: 0; }
.site-header.header-scrolled { box-shadow: 0 10px 24px -20px rgba(0,0,0,.3); }

.site-header-inner {
	display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
	min-height: var(--b4-header-h);
}
.header-layout-center .site-header-inner { flex-wrap: wrap; justify-content: center; text-align: center; }
.header-layout-center .site-branding { order: 1; width: 100%; text-align: center; }
.header-layout-center .main-navigation { order: 3; width: 100%; justify-content: center; }
.header-layout-center .header-actions { order: 2; }

.site-branding { display: flex; align-items: center; gap: .5rem .75rem; min-width: 0; flex: 1 1 auto; flex-wrap: wrap; }
.site-branding img.custom-logo { max-height: 46px; width: auto; }
.site-branding .site-title { font-family: var(--b4-font-heading); font-size: clamp(1.1rem, 1rem + 1vw, 1.4rem); font-weight: 700; margin: 0; min-width: 0; overflow-wrap: break-word; }
.site-branding .site-title a { color: var(--b4-text); }
.site-branding .site-description { display: none; font-size: .78rem; color: var(--b4-secondary); }
@media (min-width: 48em) {
	.site-branding .site-description { display: block; margin-top: 2px; }
}

.main-navigation { display: none; }
.main-navigation ul { display: flex; align-items: center; gap: 1.9rem; }
.main-navigation a { font-weight: 500; font-size: .96rem; position: relative; padding: .3rem 0; }
.main-navigation a::after {
	content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0;
	background: var(--b4-accent); transition: width .25s ease;
}
.main-navigation a:hover::after, .main-navigation .current-menu-item > a::after { width: 100%; }
.main-navigation .sub-menu { display: none; position: absolute; background: var(--b4-surface); border: 1px solid var(--b4-border); border-radius: var(--b4-radius-sm); padding: .5rem; min-width: 190px; box-shadow: 0 20px 40px -20px rgba(0,0,0,.3); }
.main-navigation li { position: relative; }
.main-navigation li:hover > .sub-menu, .main-navigation li:focus-within > .sub-menu { display: block; }
.main-navigation .sub-menu li { padding: 0; }
.main-navigation .sub-menu a { display: block; padding: .5rem .6rem; }
.main-navigation .sub-menu a::after { display: none; }

.header-actions { display: flex; align-items: center; gap: .85rem; flex-shrink: 0; }

.b4-btn {
	display: inline-flex; align-items: center; gap: .5rem; border-radius: 999px;
	padding: .68rem 1.4rem; font-weight: 600; font-size: .92rem; border: 1px solid transparent;
	transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.b4-btn:hover { transform: translateY(-2px); }
.b4-btn-primary { background: var(--b4-primary); color: #fff; box-shadow: 0 10px 22px -12px var(--b4-primary); }
.b4-btn-accent { background: var(--b4-accent); color: #fff; box-shadow: 0 10px 22px -12px var(--b4-accent); }
.b4-btn-outline { background: transparent; border-color: var(--b4-border); color: var(--b4-text); }
.b4-btn-ghost { background: transparent; color: var(--b4-text); padding: .5rem; border-radius: 50%; }

.b4-theme-toggle { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--b4-border); background: var(--b4-surface); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.b4-theme-toggle .b4-icon-moon { display: none; }
[data-theme="dark"] .b4-theme-toggle .b4-icon-sun { display: none; }
[data-theme="dark"] .b4-theme-toggle .b4-icon-moon { display: block; }

.b4-menu-toggle {
	display: flex; flex-direction: column; gap: 5px; width: 40px; height: 40px; border-radius: 50%;
	border: 1px solid var(--b4-border); background: var(--b4-surface); align-items: center; justify-content: center; cursor: pointer;
}
.b4-menu-toggle span { width: 18px; height: 2px; background: var(--b4-text); transition: transform .25s ease, opacity .25s ease; }
.b4-menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.b4-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.b4-menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-navigation {
	display: none; position: fixed; top: var(--b4-header-h); left: 0; right: 0; bottom: auto;
	background: var(--b4-base); z-index: 600; padding: 1.5rem clamp(1.1rem,4vw,2rem) 3rem;
	max-height: calc(100vh - var(--b4-header-h)); overflow-y: visible;
}
.mobile-navigation.is-open { display: block; }
.mobile-navigation ul { display: flex; flex-direction: column; }
.mobile-navigation a { display: flex; align-items: center; padding: .95rem 0; border-bottom: 1px solid var(--b4-border); font-size: 1.05rem; font-weight: 500; }
.mobile-navigation .sub-menu { padding-left: 1.25rem; }

@media (min-width: 62em) {
	.main-navigation { display: block; }
	.b4-menu-toggle { display: none; }
	.mobile-navigation { display: none !important; }
}

/* =========================================================
   6. HERO
   ========================================================= */
.b4-hero {
	position: relative; padding: clamp(3rem,8vw,6rem) 0; overflow: hidden;
	background: radial-gradient(120% 100% at 15% 0%, var(--b4-hero-glow), transparent 60%);
}
.b4-hero-grid { display: grid; grid-template-columns: 1fr; gap: clamp(2rem,5vw,3.5rem); align-items: center; }
.b4-hero-eyebrow { display: inline-flex; align-items: center; gap: .5rem; color: var(--b4-accent); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; margin-bottom: 1rem; }
.b4-hero h1 { margin-bottom: 1.1rem; }
.b4-hero p.b4-hero-sub { font-size: 1.1rem; color: var(--b4-secondary); max-width: 46ch; margin-bottom: 1.75rem; }
.b4-hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; }
.b4-hero-media .b4-pot-frame { max-width: 480px; margin-inline: auto; }

@media (min-width: 62em) {
	.b4-hero-grid { grid-template-columns: 1.05fr .95fr; }
}

/* =========================================================
   7. ZEN GARDEN ASYMMETRIC GRID (cards)
   ========================================================= */
.b4-section { padding: clamp(2.5rem,6vw,4.5rem) 0; }
.b4-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: clamp(1.5rem,4vw,2.5rem); }
.b4-section-head h2 { margin: 0; }
.b4-section-kicker { color: var(--b4-accent); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; margin-bottom: .4rem; display: block; }

/* Uniform grid — every card shares the same landscape thumbnail and
   heading size regardless of position or how short the post is; no
   "featured/bigger" first card, by request. */
.b4-zen-grid {
	display: grid; grid-template-columns: 1fr; gap: var(--b4-gap);
}
@media (min-width: 48em) {
	.b4-zen-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 62em) {
	.b4-zen-grid { grid-template-columns: repeat(3, 1fr); }
}

.b4-card {
	background: var(--b4-surface); border-radius: var(--b4-radius); border: 1px solid var(--b4-border);
	overflow: hidden; display: flex; flex-direction: column; min-width: 0;
	transition: transform .3s ease, box-shadow .3s ease;
}
.b4-card:hover { transform: translateY(-6px); box-shadow: 0 24px 44px -26px rgba(43,40,37,.35); }
.b4-card-media { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--b4-base); }
.b4-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.b4-card:hover .b4-card-media img { transform: scale(1.06); }
.b4-card-body { padding: 1.25rem 1.35rem 1.5rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.b4-cat-tag {
	display: inline-flex; align-items: center; gap: .4rem; align-self: flex-start; font-size: .74rem; font-weight: 700;
	text-transform: uppercase; letter-spacing: .04em; padding: .3rem .65rem; border-radius: 999px;
	background: var(--b4-cat-color-bg, var(--b4-cat-color-bg-default)); color: var(--b4-cat-color, var(--b4-primary));
}
.b4-cat-tag .b4-icon { width: 1em; height: 1em; }
.b4-card h3 { margin: 0; font-size: 1.1rem; }
.b4-card h3 a { color: var(--b4-text); }
.b4-card h3 a:hover { color: var(--b4-accent); }
.b4-card-excerpt { color: var(--b4-secondary); font-size: .92rem; }
.b4-card-meta { display: flex; align-items: center; gap: .6rem; font-size: .78rem; color: var(--b4-secondary); margin-top: auto; padding-top: .5rem; flex-wrap: wrap; }

/* category icon grid (homepage) */
.b4-category-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1.1rem; }
@media (min-width: 40em) { .b4-category-grid { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 62em) { .b4-category-grid { grid-template-columns: repeat(4,1fr); } }
.b4-category-pill {
	display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem;
	padding: 1.5rem 1rem; border-radius: var(--b4-radius); background: var(--b4-surface); border: 1px solid var(--b4-border);
	transition: transform .25s ease, border-color .25s ease; min-width: 0;
}
.b4-category-pill:hover { transform: translateY(-4px); border-color: var(--b4-cat-color, var(--b4-accent)); }
.b4-category-pill .b4-cat-icon-wrap {
	width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
	background: var(--b4-cat-color-bg, var(--b4-cat-color-bg-default)); color: var(--b4-cat-color, var(--b4-primary));
}
.b4-category-pill .b4-icon { width: 1.7em; height: 1.7em; }
.b4-category-pill span.cat-name { font-weight: 600; font-size: .92rem; }
.b4-category-pill span.cat-count { font-size: .74rem; color: var(--b4-secondary); }

/* =========================================================
   8. CONTENT LAYOUT (single / archive)
   ========================================================= */
.b4-content-wrap { padding: clamp(2rem,5vw,3.5rem) 0 clamp(3rem,7vw,5rem); }
.b4-layout { display: grid; grid-template-columns: 1fr; gap: clamp(2rem,4vw,3rem); align-items: start; }
.b4-layout.has-sidebar { grid-template-columns: 1fr; }
@media (min-width: 68em) {
	.b4-layout.has-sidebar { grid-template-columns: minmax(0,1fr) 300px; }
}

.b4-archive-header { margin-bottom: clamp(1.5rem,4vw,2.5rem); padding-bottom: 1.5rem; border-bottom: 1px solid var(--b4-border); }
.b4-archive-header .b4-cat-icon-wrap { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; background: var(--b4-cat-color-bg, var(--b4-cat-color-bg-default)); color: var(--b4-cat-color, var(--b4-primary)); }
.b4-archive-header .b4-cat-icon-wrap .b4-icon { width: 1.9em; height: 1.9em; }
.b4-archive-header p { color: var(--b4-secondary); max-width: 60ch; margin-top: .6rem; }

.b4-post-grid { display: grid; grid-template-columns: 1fr; gap: var(--b4-gap); }
@media (min-width: 48em) { .b4-post-grid { grid-template-columns: repeat(2,1fr); } }

article.type-post .entry-header { margin-bottom: 1.5rem; }
.entry-title { margin-bottom: .6rem; }
.entry-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font-size: .85rem; color: var(--b4-secondary); align-items: center; }
.entry-meta a { color: var(--b4-secondary); }
.entry-meta a:hover { color: var(--b4-accent); }
.entry-thumbnail { margin: 1.75rem 0; }
.entry-thumbnail.b4-pot-frame img { aspect-ratio: 16/9; }

.entry-content { max-width: 74ch; }
.entry-content > * + * { margin-top: 1.35em; }
.entry-content h2, .entry-content h3, .entry-content h4 { margin-top: 2em; scroll-margin-top: calc(var(--b4-header-h) + 16px); }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content ul { list-style: none; }
.entry-content ul > li { position: relative; padding-left: 1.5em; }
.entry-content ul > li::before {
	content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 2px;
	background: var(--b4-accent); transform: rotate(45deg);
}
.entry-content ol { list-style: decimal; }
.entry-content a { color: var(--b4-primary); text-decoration: underline; text-underline-offset: 3px; }
.entry-content blockquote {
	border-left: 3px solid var(--b4-accent); padding: .25rem 0 .25rem 1.4rem; font-style: italic; color: var(--b4-secondary);
}
.entry-content img, .entry-content figure { border-radius: var(--b4-radius-sm); }
.entry-content pre { background: var(--b4-surface); padding: 1.1rem; border-radius: var(--b4-radius-sm); overflow-x: auto; border: 1px solid var(--b4-border); }
.entry-content code { background: var(--b4-surface); padding: .15em .4em; border-radius: 5px; font-size: .9em; }
.entry-content table { border: 1px solid var(--b4-border); border-radius: var(--b4-radius-sm); overflow: hidden; }
.entry-content th, .entry-content td { border: 1px solid var(--b4-border); padding: .6rem .8rem; text-align: left; }
.wp-caption-text, figcaption { font-size: .82rem; color: var(--b4-secondary); text-align: center; margin-top: .5rem; }

.entry-footer { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--b4-border); display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.b4-tag { font-size: .78rem; padding: .3rem .7rem; border-radius: 999px; background: var(--b4-base); border: 1px solid var(--b4-border); color: var(--b4-secondary); }
.b4-tag:hover { color: var(--b4-accent); border-color: var(--b4-accent); }

.b4-author-box { display: flex; gap: 1.1rem; margin-top: 2.25rem; padding: 1.5rem; border-radius: var(--b4-radius); background: var(--b4-surface); border: 1px solid var(--b4-border); }
.b4-author-box img { border-radius: 50%; width: 64px; height: 64px; }
.b4-author-box h3 { font-size: 1rem; margin-bottom: .3rem; }
.b4-author-box p { color: var(--b4-secondary); font-size: .9rem; margin: 0; }

.b4-post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.5rem; }
.b4-post-nav a { display: block; padding: 1.1rem 1.25rem; border-radius: var(--b4-radius-sm); background: var(--b4-surface); border: 1px solid var(--b4-border); min-width: 0; }
.b4-post-nav .nav-next { text-align: right; }
.b4-post-nav span.nav-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--b4-accent); font-weight: 700; }
.b4-post-nav .nav-title { display: block; margin-top: .3rem; font-weight: 600; }
@media (max-width: 39.99em) { .b4-post-nav { grid-template-columns: 1fr; } }

/* =========================================================
   9. TABLE OF CONTENTS
   ========================================================= */
.b4-toc { background: var(--b4-surface); border: 1px solid var(--b4-border); border-radius: var(--b4-radius); padding: 1.25rem 1.4rem; margin-bottom: 2rem; }
.b4-toc-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; cursor: pointer; list-style: none; font-weight: 700; font-family: var(--b4-font-heading); font-size: 1.02rem; }
.b4-toc-title::-webkit-details-marker { display: none; }
.b4-toc-title .b4-icon-chevron { transition: transform .25s ease; }
.b4-toc[open] .b4-icon-chevron { transform: rotate(180deg); }
.b4-toc ol { padding-left: 0; margin-top: 1rem; counter-reset: toc; }
.b4-toc li { list-style: none; counter-increment: toc; margin-bottom: .55rem; font-size: .92rem; }
.b4-toc li a { color: var(--b4-secondary); }
.b4-toc li a::before { content: counter(toc) "."; color: var(--b4-accent); font-weight: 700; margin-right: .5em; }
.b4-toc li a.is-active, .b4-toc li a:hover { color: var(--b4-primary); }
.b4-toc .toc-sub { padding-left: 1.4rem; margin-top: .5rem; }

@media (min-width: 68em) {
	.b4-toc-sidebar { position: sticky; top: calc(var(--b4-header-h) + 24px); }
}

/* =========================================================
   10. SIDEBAR / WIDGETS
   ========================================================= */
.widget { background: var(--b4-surface); border: 1px solid var(--b4-border); border-radius: var(--b4-radius); padding: 1.4rem; margin-bottom: 1.5rem; }
.widget-title { font-family: var(--b4-font-heading); font-size: 1.05rem; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--b4-border); }
.widget ul li { padding: .5rem 0; border-bottom: 1px dashed var(--b4-border); font-size: .92rem; }
.widget ul li:last-child { border-bottom: 0; }
.widget select, .widget input[type=text], .widget input[type=search] { width: 100%; padding: .6rem .8rem; border-radius: var(--b4-radius-sm); border: 1px solid var(--b4-border); background: var(--b4-base); }

/* =========================================================
   11. BREADCRUMBS
   ========================================================= */
.b4-breadcrumbs { font-size: .82rem; color: var(--b4-secondary); margin-bottom: 1.25rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.b4-breadcrumbs a { color: var(--b4-secondary); }
.b4-breadcrumbs a:hover { color: var(--b4-accent); }
.b4-breadcrumbs .sep { opacity: .5; }
.b4-breadcrumbs [aria-current] { color: var(--b4-text); }

/* =========================================================
   12. LIVE SEARCH
   ========================================================= */
.b4-search-wrap { position: relative; }
.b4-search-toggle { display: flex; }
.b4-search-panel {
	position: fixed; inset: 0; background: rgba(30,33,28,.55); z-index: 950; display: none;
	align-items: flex-start; justify-content: center; padding: 6vh 1rem;
}
.b4-search-panel.is-open { display: flex; }
.b4-search-box { background: var(--b4-base); width: 100%; max-width: 640px; border-radius: var(--b4-radius); padding: 1.5rem; max-height: 82vh; overflow-y: auto; box-shadow: 0 40px 80px -30px rgba(0,0,0,.5); }
.b4-search-box form { display: flex; align-items: center; gap: .75rem; border: 1px solid var(--b4-border); border-radius: 999px; padding: .5rem .5rem .5rem 1.2rem; background: var(--b4-surface); }
.b4-search-box input[type="search"] { flex: 1; border: 0; background: transparent; outline: none; font-size: 1rem; }
.b4-search-box button[type="submit"] { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--b4-primary); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.b4-search-close { position: absolute; top: 1rem; right: 1rem; }
.b4-search-results { margin-top: 1.25rem; display: flex; flex-direction: column; gap: .6rem; }
.b4-search-result { display: flex; gap: .9rem; align-items: center; padding: .7rem; border-radius: var(--b4-radius-sm); }
.b4-search-result:hover { background: var(--b4-surface); }
.b4-search-result .b4-cat-icon-wrap { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--b4-cat-color-bg, var(--b4-cat-color-bg-default)); color: var(--b4-cat-color, var(--b4-primary)); }
.b4-search-result .b4-cat-icon-wrap .b4-icon { width: 1.3em; height: 1.3em; }
.b4-search-result-title { font-weight: 600; font-size: .95rem; }
.b4-search-result-excerpt { font-size: .8rem; color: var(--b4-secondary); }
.b4-search-status { font-size: .85rem; color: var(--b4-secondary); padding: .5rem .25rem; }

/* =========================================================
   13. AD ZONES
   ========================================================= */
.b4-ad-zone { display: flex; justify-content: center; align-items: center; margin: clamp(1.75rem,4vw,2.75rem) auto; overflow: hidden; text-align: center; }
.b4-ad-zone[data-zone="header"] { margin: 0; padding: .75rem 0; }
.b4-ad-zone .b4-ad-label { display: block; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--b4-secondary); opacity: .6; margin-bottom: .4rem; width: 100%; }

/* =========================================================
   14. FOOTER
   ========================================================= */
.site-footer { background: var(--b4-primary); color: #fff; margin-top: clamp(3rem,7vw,5rem); }
[data-theme="dark"] .site-footer { background: #171913; }
.site-footer a { color: rgba(255,255,255,.82); }
.site-footer a:hover { color: #fff; }
/* One column on mobile (Newsletter, Social, Quick Links, About stacked
   in that order), four side by side from desktop width up. */
.footer-widgets { padding: clamp(2.5rem,6vw,4rem) 0; display: grid; gap: 2.25rem; grid-template-columns: 1fr; }
.footer-widgets .widget { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }
.footer-widgets .widget-title { border-bottom-color: rgba(255,255,255,.15); }
.footer-widgets .widget ul li { border-bottom-color: rgba(255,255,255,.1); }
@media (min-width: 48em) {
	.footer-widgets { grid-template-columns: repeat(2,1fr); }
}
@media (min-width: 68em) {
	.footer-widgets { grid-template-columns: repeat(4,1fr); }
}

.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 1.5rem 0; text-align: center; font-size: .85rem; }
.footer-social { display: flex; flex-wrap: wrap; gap: .6rem; }
.footer-social a { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; color: #fff; }
.footer-social a .b4-icon { width: 1.15em; height: 1.15em; stroke-width: 2; }
.footer-social a:hover { background: rgba(255,255,255,.12); }
.footer-menu ul { display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* =========================================================
   15. MISC: 404, comments, pagination
   ========================================================= */
.b4-404 { text-align: center; padding: clamp(4rem,10vw,7rem) 0; }
.b4-404 .b4-icon { width: 90px; height: 90px; color: var(--b4-secondary); margin: 0 auto 1.5rem; }

.b4-pagination { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2.5rem; justify-content: center; }
.b4-pagination a, .b4-pagination span { min-width: 42px; height: 42px; padding: 0 .6rem; border-radius: var(--b4-radius-sm); display: flex; align-items: center; justify-content: center; border: 1px solid var(--b4-border); font-size: .9rem; }
.b4-pagination .current { background: var(--b4-primary); color: #fff; border-color: var(--b4-primary); }
.b4-pagination a:hover { border-color: var(--b4-accent); color: var(--b4-accent); }

#comments { margin-top: 3rem; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; padding-left: clamp(1rem,4vw,2.5rem); }
.comment-body { padding: 1.25rem 0; border-bottom: 1px solid var(--b4-border); display: flex; gap: 1rem; }
.comment-body .avatar { border-radius: 50%; flex-shrink: 0; }
.comment-author { font-weight: 700; font-size: .92rem; }
.comment-metadata { font-size: .78rem; color: var(--b4-secondary); margin-bottom: .5rem; }
.comment-content p { margin-top: .5rem; }
.comment-reply-link { font-size: .8rem; color: var(--b4-accent); font-weight: 600; }
.comment-respond { margin-top: 2rem; padding: 1.5rem; border-radius: var(--b4-radius); background: var(--b4-surface); border: 1px solid var(--b4-border); }
.comment-form p { margin-bottom: 1rem; }
.comment-form label { display: block; font-size: .85rem; margin-bottom: .35rem; font-weight: 600; }
.comment-form input[type=text], .comment-form input[type=email], .comment-form input[type=url], .comment-form textarea {
	width: 100%; padding: .75rem .9rem; border-radius: var(--b4-radius-sm); border: 1px solid var(--b4-border); background: var(--b4-base);
}
.comment-form textarea { min-height: 140px; }
.comment-form .form-submit input { cursor: pointer; }

/* wp core blocks / alignment */
.alignwide { max-width: calc(74ch + 4rem); }
.alignfull { max-width: 100%; width: 100%; margin-left: 0; }
.aligncenter { margin-left: auto; margin-right: auto; }
.alignleft { float: left; margin-right: 1.5rem; }
.alignright { float: right; margin-left: 1.5rem; }

