/*
Theme Name: SnailWorld
Theme URI: https://snailworld.com
Author: SnailWorld
Author URI: https://snailworld.com
Description: A custom garden/snail-inspired WordPress theme for SnailWorld. Fully customizable via the WordPress Customizer, mobile-first responsive, AdSense-optimized and built for Core Web Vitals.
Version: 1.4.2
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: snailworld
Tags: blog, one-column, two-columns, right-sidebar, custom-colors, custom-logo, custom-menu, featured-images, sticky-post, threaded-comments, translation-ready, dark-mode

SnailWorld 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 only — the real, Customizer-driven values
   (including derived ones like --sw-surface/--sw-border/
   --sw-cat-color-bg) are computed in PHP and injected as an
   inline <style> block by inc/customizer-output.php. Every
   derived color is plain rgba()/hex — deliberately NOT
   color-mix(), which a meaningful slice of real-world browsers
   and in-app webviews still don't support, and which silently
   drops the whole declaration (background/border vanish
   entirely) where it's missing rather than degrading gracefully.
   ========================================================= */
:root {
	/* light palette */
	--sw-base: #F7F3E7;
	--sw-surface: #FBF8F1;
	--sw-primary: #52734D;
	--sw-secondary: #8A5E3C;
	--sw-accent: #E08966;
	--sw-text: #2A2823;
	--sw-highlight: #D9AE5D;
	--sw-border: rgba(42, 40, 35, 0.12);
	--sw-header-bg: rgba(247, 243, 231, 0.92);
	--sw-hero-glow: rgba(82, 115, 77, 0.12);
	--sw-cat-color-bg-default: rgba(82, 115, 77, 0.15);

	/* type */
	--sw-font-heading: "Fraunces", "Noto Serif", serif;
	--sw-font-body: "Public Sans", "Noto Sans", sans-serif;
	--sw-font-size-base: 1rem;

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

	color-scheme: light;
}

[data-theme="dark"] {
	--sw-base: #1D2119;
	--sw-surface: #262B22;
	--sw-primary: #8FB284;
	--sw-secondary: #C79A6E;
	--sw-accent: #EDA07E;
	--sw-text: #ECE7D9;
	--sw-highlight: #E8C57E;
	--sw-border: rgba(236, 231, 217, 0.14);
	--sw-header-bg: rgba(29, 33, 25, 0.92);
	--sw-hero-glow: rgba(143, 178, 132, 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(--sw-base) !important;
	color: var(--sw-text) !important;
	font-family: var(--sw-font-body);
	font-size: var(--sw-font-size-base);
	line-height: 1.75;
	overflow-x: hidden;
	transition: background-color .35s ease, color .35s ease;
}

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

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

h1 { font-size: clamp(1.95rem, 1.45rem + 2vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2.3rem); }
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; }

.sw-container {
	width: 100%;
	max-width: var(--sw-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(--sw-primary); color: #fff; padding: .75rem 1.25rem;
	border-radius: var(--sw-radius-sm); transition: top .2s ease;
}
.skip-link:focus { top: 1rem; }

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

/* =========================================================
   3. GARDEN / SNAIL MOTIFS
   ========================================================= */
.sw-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; }

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

/* organic, blob-shaped media frame */
.sw-organic-frame {
	position: relative;
	border-radius: 63% 37% 54% 46% / 46% 53% 47% 54%;
	overflow: hidden;
	background: var(--sw-surface);
	box-shadow: 0 18px 40px -22px rgba(42,40,35,.35);
}
.sw-organic-frame img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; }

/* snail reading-progress bar (fixed top, snail rides the leading edge) */
.sw-progress-bar {
	position: fixed; top: 0; left: 0; right: 0; height: 5px; z-index: 900;
	background: transparent; opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.sw-progress-bar.is-visible { opacity: 1; }
.sw-progress-track { position: absolute; inset: 0; background: var(--sw-border); }
.sw-progress-fill { position: absolute; inset: 0; width: 0%; background: linear-gradient(90deg, var(--sw-primary), var(--sw-accent)); transition: width .12s linear; }
.sw-progress-snail {
	position: absolute; top: 50%; left: 0%; width: 26px; height: 26px;
	transform: translate(-50%, -50%); color: var(--sw-accent); background: var(--sw-base);
	border-radius: 50%; display: flex; align-items: center; justify-content: center;
	box-shadow: 0 3px 10px rgba(0,0,0,.25); transition: left .12s linear;
}
.sw-progress-snail .sw-icon { width: 1.1em; height: 1.1em; }
.sw-back-to-top {
	position: fixed; right: clamp(14px, 3vw, 30px); bottom: clamp(14px, 3vw, 30px);
	width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--sw-border);
	background: var(--sw-surface); color: var(--sw-primary); display: flex; align-items: center; justify-content: center;
	z-index: 900; opacity: 0; pointer-events: none; transition: opacity .3s ease, transform .2s ease;
	cursor: pointer;
}
.sw-back-to-top.is-visible { opacity: 1; pointer-events: auto; }
.sw-back-to-top:hover { transform: translateY(-3px); }
.sw-icon-rotate-up { transform: rotate(-90deg); }

/* =========================================================
   4. SCROLL-IN ANIMATIONS (CSS only, JS-independent)
   .sw-reveal starts hidden and is normally revealed instantly
   by JS (main.js) via IntersectionObserver as soon as an
   element is in view — but it must never depend on JS alone:
   a cache/optimization plugin that delays script execution
   (common on shared hosting) can otherwise leave real content
   invisible forever. The animation below is the guarantee: if
   JS hasn't revealed the element within 1.2s, it reveals itself.
   When JS does run first (the normal case), .is-visible takes
   over and the animation is cancelled, so nothing double-fires.
   ========================================================= */
.sw-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);
	animation: sw-reveal-fallback 0.01ms 1.2s forwards;
}
@keyframes sw-reveal-fallback {
	to { opacity: 1; transform: none; }
}
.sw-reveal.is-visible { opacity: 1; transform: none; animation: none; }
.js .sw-reveal { will-change: opacity, transform; }
.no-js .sw-reveal { opacity: 1; transform: none; animation: none; }

/* =========================================================
   5. HEADER
   ========================================================= */
.site-header {
	background: var(--sw-header-bg);
	backdrop-filter: saturate(140%) blur(10px);
	border-bottom: 1px solid var(--sw-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: .75rem 1.5rem;
	min-height: var(--sw-header-h);
	flex-wrap: wrap;
}
.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(--sw-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(--sw-text); }
/* Decorative tagline: only shown once there's room for it beside the
   title — on narrow phones it used to be squeezed into a near-1-char-wide
   column fighting the title for space, which is what "text cut off"
   looked like. */
.site-branding .site-description { display: none; font-size: .78rem; color: var(--sw-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(--sw-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(--sw-surface); border: 1px solid var(--sw-border); border-radius: var(--sw-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; }

.sw-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;
}
.sw-btn:hover { transform: translateY(-2px); }
.sw-btn-primary { background: var(--sw-primary); color: #fff; box-shadow: 0 10px 22px -12px var(--sw-primary); }
.sw-btn-accent { background: var(--sw-accent); color: #fff; box-shadow: 0 10px 22px -12px var(--sw-accent); }
.sw-btn-outline { background: transparent; border-color: var(--sw-border); color: var(--sw-text); }
.sw-btn-ghost { background: transparent; color: var(--sw-text); padding: .5rem; border-radius: 50%; }

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

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

.mobile-navigation {
	display: none; position: fixed; top: var(--sw-header-h); left: 0; right: 0; bottom: auto;
	background: var(--sw-base); z-index: 600; padding: 1.5rem clamp(1.1rem,4vw,2rem) 3rem;
	max-height: calc(100vh - var(--sw-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(--sw-border); font-size: 1.05rem; font-weight: 500; }
.mobile-navigation .sub-menu { padding-left: 1.25rem; }

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

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

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

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

/* Every card the same: landscape thumbnail, same title size, same
   layout — no "featured/bigger" first card, by request (uniform grid
   instead of an asymmetric magazine layout). */
.sw-garden-grid {
	display: grid; grid-template-columns: 1fr; gap: var(--sw-gap);
}
@media (min-width: 48em) {
	.sw-garden-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 62em) {
	.sw-garden-grid { grid-template-columns: repeat(3, 1fr); }
}

.sw-card {
	background: var(--sw-surface); border-radius: var(--sw-radius); border: 1px solid var(--sw-border);
	overflow: hidden; display: flex; flex-direction: column; min-width: 0;
	transition: transform .3s ease, box-shadow .3s ease;
}
.sw-card:hover { transform: translateY(-6px); box-shadow: 0 24px 44px -26px rgba(42,40,35,.35); }
.sw-card-media { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--sw-base); }
.sw-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.sw-card:hover .sw-card-media img { transform: scale(1.06); }
.sw-card-body { padding: 1.25rem 1.35rem 1.5rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.sw-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(--sw-cat-color-bg, var(--sw-cat-color-bg-default)); color: var(--sw-cat-color, var(--sw-primary));
}
.sw-cat-tag .sw-icon { width: 1em; height: 1em; }
.sw-card h3 { margin: 0; font-size: 1.1rem; }
.sw-card h3 a { color: var(--sw-text); }
.sw-card h3 a:hover { color: var(--sw-accent); }
.sw-card-excerpt { color: var(--sw-secondary); font-size: .92rem; }
.sw-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; font-size: .78rem; color: var(--sw-secondary); margin-top: auto; padding-top: .5rem; }


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

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

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

.sw-post-grid { display: grid; grid-template-columns: 1fr; gap: var(--sw-gap); }
@media (min-width: 48em) { .sw-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(--sw-secondary); align-items: center; }
.entry-meta a { color: var(--sw-secondary); }
.entry-meta a:hover { color: var(--sw-accent); }
.entry-thumbnail { margin: 1.75rem 0; }
.entry-thumbnail.sw-organic-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(--sw-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: .6em; width: 8px; height: 8px; border-radius: 50% 50% 50% 0;
	background: var(--sw-accent); transform: rotate(45deg);
}
.entry-content ol { list-style: decimal; }
.entry-content a { color: var(--sw-primary); text-decoration: underline; text-underline-offset: 3px; }
.entry-content blockquote {
	border-left: 3px solid var(--sw-accent); padding: .25rem 0 .25rem 1.4rem; font-style: italic; color: var(--sw-secondary);
}
.entry-content img, .entry-content figure { border-radius: var(--sw-radius-sm); }
.entry-content pre { background: var(--sw-surface); padding: 1.1rem; border-radius: var(--sw-radius-sm); overflow-x: auto; border: 1px solid var(--sw-border); }
.entry-content code { background: var(--sw-surface); padding: .15em .4em; border-radius: 5px; font-size: .9em; }
.entry-content table { border: 1px solid var(--sw-border); border-radius: var(--sw-radius-sm); overflow: hidden; }
.entry-content th, .entry-content td { border: 1px solid var(--sw-border); padding: .6rem .8rem; text-align: left; }
.wp-caption-text, figcaption { font-size: .82rem; color: var(--sw-secondary); text-align: center; margin-top: .5rem; }

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

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

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

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

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

/* =========================================================
   10. SIDEBAR / WIDGETS
   ========================================================= */
.widget { background: var(--sw-surface); border: 1px solid var(--sw-border); border-radius: var(--sw-radius); padding: 1.4rem; margin-bottom: 1.5rem; }
.widget-title { font-family: var(--sw-font-heading); font-size: 1.05rem; margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--sw-border); }
.widget ul li { padding: .5rem 0; border-bottom: 1px dashed var(--sw-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(--sw-radius-sm); border: 1px solid var(--sw-border); background: var(--sw-base); }

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

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

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

/* =========================================================
   14. FOOTER
   ========================================================= */
.site-footer { background: var(--sw-primary); color: #fff; margin-top: clamp(3rem,7vw,5rem); }
[data-theme="dark"] .site-footer { background: #161911; }
.site-footer a { color: rgba(255,255,255,.82); }
.site-footer a:hover { color: #fff; }

/* Newsletter, Social, Quick Links, About: four equal columns on
   desktop, stacked one-per-row on mobile — see .footer-widgets below. */
.sw-newsletter-subtext { color: rgba(255,255,255,.75); font-size: .9rem; margin: 0 0 .9rem; }
.sw-newsletter-form form { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; }
.sw-newsletter-form input[type="email"],
.sw-newsletter-form input[type="text"] {
	flex: 1 1 140px; min-width: 0; padding: .7rem 1rem; border-radius: 999px;
	border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff;
}
.sw-newsletter-form input::placeholder { color: rgba(255,255,255,.6); }
.sw-newsletter-form button,
.sw-newsletter-form input[type="submit"] {
	flex: 0 0 auto; padding: .7rem 1.4rem; border-radius: 999px; border: 0; cursor: pointer;
	background: var(--sw-accent); color: #fff; font-weight: 600;
}
.sw-newsletter-message { display: block; margin: 0; padding: .7rem 0 0; font-size: .9rem; font-weight: 600; color: #fff; }
.sw-newsletter-message.is-error { color: #ffb4a1; }

/* 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 .sw-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
   ========================================================= */
.sw-404 { text-align: center; padding: clamp(4rem,10vw,7rem) 0; }
.sw-404 .sw-icon { width: 90px; height: 90px; color: var(--sw-secondary); margin: 0 auto 1.5rem; }

.sw-pagination { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2.5rem; justify-content: center; }
.sw-pagination a, .sw-pagination span { min-width: 42px; height: 42px; padding: 0 .6rem; border-radius: var(--sw-radius-sm); display: flex; align-items: center; justify-content: center; border: 1px solid var(--sw-border); font-size: .9rem; }
.sw-pagination .current { background: var(--sw-primary); color: #fff; border-color: var(--sw-primary); }
.sw-pagination a:hover { border-color: var(--sw-accent); color: var(--sw-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(--sw-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(--sw-secondary); margin-bottom: .5rem; }
.comment-content p { margin-top: .5rem; }
.comment-reply-link { font-size: .8rem; color: var(--sw-accent); font-weight: 600; }
.comment-respond { margin-top: 2rem; padding: 1.5rem; border-radius: var(--sw-radius); background: var(--sw-surface); border: 1px solid var(--sw-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(--sw-radius-sm); border: 1px solid var(--sw-border); background: var(--sw-base);
}
.comment-form textarea { min-height: 140px; }
.comment-form .form-submit input { cursor: pointer; }

/* wp core blocks / alignment */
.alignwide { max-width: calc(74ch + 4rem); }
/* 100vw (rather than 100%) is a well-known source of a few pixels of
   horizontal overflow on mobile browsers, since it can measure wider
   than the actual visible viewport. Stick to 100% of the nearest
   positioned ancestor instead — visually identical, never overflows. */
.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; }
