/*
Theme Name: Sipwise
Theme URI: https://juiceradvices.com/
Author: JuicerAdvices
Author URI: https://juiceradvices.com/
Description: A fast, mobile-first WordPress theme built for beverage-safety and drink-health reference sites. Content-first layout, compact header, customizable sidebar with optional table of contents, related posts, automatic fallback featured images, and reserved ad slots tuned for Ezoic and Amazon.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sipwise
Tags: blog, one-column, two-columns, right-sidebar, custom-colors, custom-menu, featured-images, threaded-comments, translation-ready, block-styles, wide-blocks
*/

/* ==========================================================================
   1. Design tokens
   ========================================================================== */

:root {
	/* Brand — fresh citrus over a clinical, trustworthy base */
	--sw-primary: #0f7b5f;
	--sw-primary-dark: #0a5b46;
	--sw-primary-light: #e6f4ef;
	--sw-accent: #f59e0b;
	--sw-accent-dark: #b97309;
	--sw-accent-light: #fef3e2;

	/* Verdict colors — used by the safety callout blocks */
	--sw-safe: #15803d;
	--sw-safe-bg: #edfaf1;
	--sw-caution: #b45309;
	--sw-caution-bg: #fef6e7;
	--sw-avoid: #b91c1c;
	--sw-avoid-bg: #fdeded;

	/* Neutrals */
	--sw-ink: #14201c;
	--sw-ink-soft: #4a5854;
	--sw-ink-mute: #6b7a75;
	--sw-line: #e2e8e5;
	--sw-line-soft: #eef2f0;
	--sw-bg: #ffffff;
	--sw-bg-alt: #f6f8f7;

	/* Type */
	--sw-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--sw-font-head: var(--sw-font);
	--sw-fs-base: 1.0625rem;
	--sw-lh-base: 1.7;

	/* Layout */
	--sw-content-w: 720px;
	--sw-wide-w: 1180px;
	--sw-gap: 2.5rem;
	--sw-radius: 10px;
	--sw-radius-sm: 6px;

	/* Elevation */
	--sw-shadow-sm: 0 1px 2px rgba(20, 32, 28, .06);
	--sw-shadow: 0 2px 8px rgba(20, 32, 28, .07);
	--sw-shadow-lg: 0 8px 28px rgba(20, 32, 28, .10);

	/* Header height — drives the sticky offsets */
	--sw-header-h: 54px;

	/* Two-tone logo (overridden from the Customizer) */
	--sw-logo-a: #4a9d2f;
	--sw-logo-a-soft: #e8f4e3;
	--sw-logo-b: #f0871f;
}

/* Optional dark mode (opt-in via Customizer -> body class) */
body.sw-dark {
	--sw-ink: #e8efec;
	--sw-ink-soft: #b3c1bc;
	--sw-ink-mute: #8b9a95;
	--sw-line: #2a3733;
	--sw-line-soft: #212c29;
	--sw-bg: #131a18;
	--sw-bg-alt: #1a2321;
	--sw-primary-light: #16302a;
	--sw-accent-light: #2e2415;
	--sw-safe-bg: #14281c;
	--sw-caution-bg: #2c2314;
	--sw-avoid-bg: #2c1919;
}

/* ==========================================================================
   2. Reset & base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	max-width: 100%;
	/* Off-canvas panels (mobile nav, TOC drawer) sit outside the viewport and
	   would create a phantom scrollable strip on the right.
	   `clip` suppresses that WITHOUT creating a scroll container — which
	   `overflow-x: hidden` would, silently breaking every position: sticky
	   descendant, including the header and the sidebar. */
	overflow-x: clip;
}

/* Older engines without overflow: clip. They lose sticky, not layout. */
@supports not (overflow: clip) {
	html { overflow-x: hidden; }
}
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
	margin: 0;
	font-family: var(--sw-font);
	font-size: var(--sw-fs-base);
	line-height: var(--sw-lh-base);
	color: var(--sw-ink);
	background: var(--sw-bg);
	-webkit-font-smoothing: antialiased;
	overflow-x: clip;
	max-width: 100%;
	position: relative;
}

@supports not (overflow: clip) {
	body { overflow-x: hidden; }
}

/* Nothing may exceed the viewport width. alignfull opts out deliberately. */
.sw-shell, .sw-container, .sw-main, .sw-entry-content, .sw-sidebar { max-width: 100%; min-width: 0; }
.sw-entry-content > * { max-width: 100%; }

img, svg, video, iframe { max-width: 100%; height: auto; display: block; }
a { color: var(--sw-primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--sw-primary-dark); }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--sw-font-head);
	line-height: 1.25;
	color: var(--sw-ink);
	margin: 2rem 0 .75rem;
	font-weight: 700;
	letter-spacing: -.015em;
}
h1 { font-size: clamp(1.75rem, 4.2vw, 2.35rem); margin-top: 0; }
h2 { font-size: clamp(1.35rem, 3vw, 1.6rem); }
h3 { font-size: clamp(1.15rem, 2.4vw, 1.28rem); }
h4 { font-size: 1.08rem; }

p, ul, ol, dl, table, pre, blockquote, figure { margin: 0 0 1.15rem; }
ul, ol { padding-left: 1.35rem; }
li { margin-bottom: .4rem; }

hr { border: 0; border-top: 1px solid var(--sw-line); margin: 2.5rem 0; }

blockquote {
	margin: 1.5rem 0;
	padding: .25rem 0 .25rem 1.15rem;
	border-left: 3px solid var(--sw-accent);
	color: var(--sw-ink-soft);
	font-style: italic;
}

code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
code { background: var(--sw-bg-alt); padding: .12em .38em; border-radius: 4px; }
pre { background: var(--sw-bg-alt); padding: 1rem; border-radius: var(--sw-radius-sm); overflow-x: auto; }
pre code { background: none; padding: 0; }

/* Tables scroll inside their own container, never the page */
.sw-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1.15rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { border: 1px solid var(--sw-line); padding: .6rem .75rem; text-align: left; vertical-align: top; }
th { background: var(--sw-bg-alt); font-weight: 600; }

/* Accessibility */
.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0;
	position: absolute !important; word-wrap: normal !important;
}
.sw-skip-link {
	position: absolute; left: -9999px; top: 0; z-index: 999;
	background: var(--sw-primary); color: #fff; padding: .7rem 1.1rem; border-radius: 0 0 var(--sw-radius-sm) 0;
}
.sw-skip-link:focus { left: 0; color: #fff; }
:focus-visible { outline: 2px solid var(--sw-accent); outline-offset: 2px; }

/* ==========================================================================
   3. Layout shell
   ========================================================================== */

.sw-container { width: 100%; max-width: var(--sw-wide-w); margin: 0 auto; padding: 0 1.15rem; }

.sw-shell {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--sw-gap);
	max-width: var(--sw-wide-w);
	margin: 0 auto;
	padding: 1.5rem 1.15rem 3rem;
}

/* Two-column only when a sidebar is actually rendered */
.sw-has-sidebar .sw-shell { grid-template-columns: minmax(0, 1fr); }

@media (min-width: 1024px) {
	.sw-has-sidebar .sw-shell { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* No sidebar: centre the column and leave the gutters free for banner rails. */
.sw-no-sidebar .sw-shell { justify-items: center; }
.sw-no-sidebar .sw-main { width: 100%; max-width: var(--sw-content-w); }
.sw-no-sidebar .sw-entry-inner { max-width: none; }

@media (min-width: 1024px) {
	.sw-no-sidebar .sw-shell { padding-top: 2rem; }
	.sw-no-sidebar .sw-main {
		max-width: 820px;
		background: var(--sw-bg);
		border: 1px solid var(--sw-line);
		border-radius: 14px;
		padding: 2.25rem 2.5rem 2.75rem;
		box-shadow: var(--sw-shadow-sm);
	}
	body.sw-no-sidebar { background: var(--sw-bg-alt); }
	body.sw-no-sidebar .sw-header,
	body.sw-no-sidebar .sw-footer { background: var(--sw-bg); }
}

.sw-main { min-width: 0; }

/* Content measure: comfortable reading width inside the main column */
.sw-entry-inner { max-width: var(--sw-content-w); }
.sw-has-sidebar .sw-entry-inner { max-width: none; }

/* ==========================================================================
   4. Header — deliberately compact so content sits in the first viewport
   ========================================================================== */

.sw-header {
	position: relative;
	z-index: 100;
	background: var(--sw-bg);
	border-bottom: 1px solid var(--sw-line);
}

/* Sticky top bar — desktop only. On mobile a fixed bar costs too much screen. */
@media (min-width: 1024px) {
	body.sw-sticky-header .sw-header { position: sticky; top: 0; }
}
.sw-header-inner {
	display: flex;
	align-items: center;
	gap: 1rem;
	height: var(--sw-header-h);
	max-width: var(--sw-wide-w);
	margin: 0 auto;
	padding: 0 1.15rem;
}

.sw-brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; flex-shrink: 0; }
.sw-brand:hover { text-decoration: none; }
.sw-brand-mark { width: 26px; height: 26px; flex-shrink: 0; }
.sw-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.sw-brand-name { font-weight: 800; font-size: 1.02rem; color: var(--sw-ink); letter-spacing: -.02em; }
.sw-logo-a { color: var(--sw-logo-a); }
.sw-logo-b { color: var(--sw-logo-b); margin-left: .22em; }
.sw-brand-tag { font-size: .66rem; color: var(--sw-ink-mute); font-weight: 500; letter-spacing: .02em; }
.sw-logo-img { max-height: 34px; width: auto; }

/* Primary nav */
.sw-nav { margin-left: auto; }
.sw-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .15rem; }
.sw-nav li { margin: 0; position: relative; }
.sw-nav a {
	display: block; padding: .45rem .6rem; font-size: .9rem; font-weight: 550;
	color: var(--sw-ink-soft); text-decoration: none; border-radius: var(--sw-radius-sm);
	white-space: nowrap;
}
.sw-nav a:hover, .sw-nav li.current-menu-item > a, .sw-nav li.current-menu-ancestor > a {
	color: var(--sw-primary); background: var(--sw-primary-light);
}

/* Dropdowns */
.sw-nav .sub-menu {
	position: absolute; top: 100%; left: 0; min-width: 218px;
	background: var(--sw-bg); border: 1px solid var(--sw-line);
	border-radius: var(--sw-radius); box-shadow: var(--sw-shadow-lg);
	padding: .35rem; display: block; flex-direction: column; gap: 0;
	opacity: 0; visibility: hidden; transform: translateY(4px);
	transition: opacity .14s ease, transform .14s ease, visibility .14s;
	z-index: 120;
}
.sw-nav li:hover > .sub-menu,
.sw-nav li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.sw-nav .sub-menu li { width: 100%; }
.sw-nav .sub-menu a { padding: .5rem .65rem; font-size: .88rem; width: 100%; }
.sw-nav .sub-menu .sub-menu { top: 0; left: 100%; }
.sw-nav .menu-item-has-children > a::after {
	content: ""; display: inline-block; width: .34em; height: .34em;
	border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translateY(-2px); margin-left: .4em; opacity: .6;
}

/* Header utilities */
.sw-header-tools { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }
.sw-icon-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 34px; height: 34px; padding: 0;
	background: none; border: 1px solid transparent; border-radius: var(--sw-radius-sm);
	color: var(--sw-ink-soft); cursor: pointer;
}
.sw-icon-btn:hover { background: var(--sw-bg-alt); color: var(--sw-primary); }
.sw-icon-btn svg { width: 18px; height: 18px; }

.sw-burger { display: none; }

/* Mobile nav */
@media (max-width: 1023px) {
	.sw-burger { display: inline-flex; }

	/* The nav leaves the flow on mobile, so the tools must claim the free
	   space themselves or they bunch up against the logo. */
	.sw-header-tools { margin-left: auto; }

	.sw-nav {
		position: fixed; inset: var(--sw-header-h) 0 0 0;
		background: var(--sw-bg); overflow-y: auto; padding: .75rem 1.15rem 2rem;
		transform: translateX(-100%); transition: transform .22s ease; margin-left: 0;
		border-top: 1px solid var(--sw-line);
		visibility: hidden;
	}
	.sw-nav.is-open { visibility: visible; }
	.sw-nav.is-open { transform: translateX(0); }
	.sw-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
	.sw-nav > div > ul > li { border-bottom: 1px solid var(--sw-line-soft); }
	.sw-nav a { padding: .8rem .2rem; font-size: 1rem; border-radius: 0; }
	.sw-nav .sub-menu {
		position: static; opacity: 1; visibility: visible; transform: none;
		border: 0; box-shadow: none; padding: 0 0 .5rem .9rem; min-width: 0;
		display: none;
	}
	.sw-nav .sub-menu.is-open { display: block; }
	.sw-nav .menu-item-has-children > a::after { float: right; margin-top: .55em; }
	body.sw-nav-open { overflow: hidden; }
}

/* Header search panel */
.sw-search-panel {
	display: none; border-bottom: 1px solid var(--sw-line); background: var(--sw-bg-alt);
	padding: .75rem 0;
}
.sw-search-panel.is-open { display: block; }
.sw-search-panel .sw-container { max-width: 640px; }

/* ==========================================================================
   5. Forms
   ========================================================================== */

.sw-search-form { display: flex; gap: .45rem; }
input[type="text"], input[type="search"], input[type="email"], input[type="url"], textarea, select {
	width: 100%; padding: .58rem .75rem; font: inherit; font-size: .95rem;
	color: var(--sw-ink); background: var(--sw-bg);
	border: 1px solid var(--sw-line); border-radius: var(--sw-radius-sm);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--sw-primary); box-shadow: 0 0 0 3px var(--sw-primary-light); }

.sw-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
	padding: .58rem 1.05rem; font: inherit; font-size: .92rem; font-weight: 600;
	color: #fff; background: var(--sw-primary); border: 1px solid var(--sw-primary);
	border-radius: var(--sw-radius-sm); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.sw-btn:hover { background: var(--sw-primary-dark); border-color: var(--sw-primary-dark); color: #fff; text-decoration: none; }
.sw-btn-ghost { color: var(--sw-primary); background: transparent; border-color: var(--sw-line); }
.sw-btn-ghost:hover { background: var(--sw-primary-light); color: var(--sw-primary-dark); border-color: var(--sw-primary); }
.sw-btn-accent { background: var(--sw-accent); border-color: var(--sw-accent); color: #3b2708; }
.sw-btn-accent:hover { background: var(--sw-accent-dark); border-color: var(--sw-accent-dark); color: #fff; }

/* ==========================================================================
   6. Entry (single / page)
   ========================================================================== */

.sw-entry-header { margin-bottom: 1.25rem; }

/* Breadcrumbs — compact, above the title */
.sw-breadcrumbs {
	font-size: .8rem; color: var(--sw-ink-mute); margin-bottom: .6rem;
	display: flex; flex-wrap: wrap; gap: .3rem; align-items: center;
}
.sw-breadcrumbs a { color: var(--sw-ink-mute); text-decoration: none; }
.sw-breadcrumbs a:hover { color: var(--sw-primary); text-decoration: underline; }
.sw-breadcrumbs .sep { opacity: .5; }

.sw-entry-title { margin: 0 0 .5rem; }

.sw-entry-meta {
	display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .85rem;
	font-size: .83rem; color: var(--sw-ink-mute); margin-bottom: 1rem;
}
.sw-entry-meta .sw-meta-item { display: inline-flex; align-items: center; gap: .3rem; }
.sw-entry-meta svg { width: 14px; height: 14px; opacity: .7; }
.sw-entry-meta a { color: var(--sw-ink-mute); }

.sw-entry-content { font-size: var(--sw-fs-base); }
.sw-entry-content > *:first-child { margin-top: 0; }
.sw-entry-content h2 { padding-top: .35rem; scroll-margin-top: calc(var(--sw-header-h) + 12px); }
.sw-entry-content h3, .sw-entry-content h4 { scroll-margin-top: calc(var(--sw-header-h) + 12px); }
.sw-entry-content img { border-radius: var(--sw-radius); }
.sw-entry-content figure { margin: 1.5rem 0; }
.sw-entry-content figcaption { font-size: .83rem; color: var(--sw-ink-mute); text-align: center; margin-top: .5rem; }

/* Featured image, when shown, sits BELOW the title/meta — never above */
.sw-featured-below { margin: 0 0 1.5rem; }
.sw-featured-below img { border-radius: var(--sw-radius); width: 100%; }

.sw-entry-footer { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--sw-line); }
.sw-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.sw-tag,
.sw-tags a {
	display: inline-block;
	font-size: .78rem; padding: .25rem .6rem; background: var(--sw-bg-alt);
	color: var(--sw-ink-soft); border-radius: 100px; text-decoration: none; border: 1px solid var(--sw-line);
}
.sw-tag:hover,
.sw-tags a:hover { background: var(--sw-primary-light); color: var(--sw-primary); border-color: var(--sw-primary); }

/* ==========================================================================
   7. Table of contents
   ========================================================================== */

/* Floating toggle button — hidden by default on BOTH mobile and desktop.
   Enable per-device in Customizer -> Sipwise: Sidebar & TOC. */
.sw-toc-toggle {
	display: none;
	position: fixed; right: 1rem; bottom: 1rem; z-index: 95;
	align-items: center; gap: .4rem;
	padding: .6rem .9rem; font-size: .87rem; font-weight: 600;
	color: #fff; background: var(--sw-primary); border: 0;
	border-radius: 100px; box-shadow: var(--sw-shadow-lg); cursor: pointer;
}
.sw-toc-toggle svg { width: 16px; height: 16px; }
.sw-toc-toggle:hover { background: var(--sw-primary-dark); }

/* Opt-in visibility */
body.sw-toc-btn-desktop .sw-toc-toggle { display: none; }
@media (min-width: 1024px) {
	body.sw-toc-btn-desktop .sw-toc-toggle { display: inline-flex; }
}
@media (max-width: 1023px) {
	body.sw-toc-btn-mobile .sw-toc-toggle { display: inline-flex; }
}

/* Table of contents card */
.sw-toc {
	background: var(--sw-bg-alt);
	border: 1px solid var(--sw-line);
	border-radius: var(--sw-radius);
	margin: 0 0 1.75rem;
	overflow: hidden;
}

/* Header row: icon + label (+ chevron when collapsible) */
.sw-toc-head {
	display: flex; align-items: center; gap: .55rem; width: 100%;
	padding: .85rem 1.05rem; margin: 0;
	background: none; border: 0; text-align: left;
	font: inherit; font-size: .78rem; font-weight: 800;
	text-transform: uppercase; letter-spacing: .085em;
	color: var(--sw-accent-dark);
}
.sw-toc-collapsible .sw-toc-head { cursor: pointer; }
.sw-toc-collapsible .sw-toc-head:hover { background: rgba(0, 0, 0, .02); }
.sw-toc-icon { width: 16px; height: 16px; flex-shrink: 0; }
.sw-toc-label { flex: 1; min-width: 0; }
.sw-toc-chevron {
	width: 18px; height: 18px; flex-shrink: 0; color: var(--sw-accent-dark);
	transition: transform .18s ease;
}
.sw-toc.is-collapsed .sw-toc-chevron { transform: rotate(-90deg); }

/* Panel */
.sw-toc-panel {
	background: var(--sw-bg);
	border-top: 1px solid var(--sw-line);
	padding: .5rem 0;
}
.sw-toc.is-collapsed .sw-toc-panel { display: none; }
.sw-toc ol { list-style: none; margin: 0; padding: 0; }
.sw-toc li { margin: 0; }
.sw-toc a {
	display: block;
	padding: .5rem 1.05rem;
	font-size: .92rem; line-height: 1.45;
	color: var(--sw-ink-soft); text-decoration: none;
	border-left: 3px solid transparent;
}
.sw-toc a:hover { color: var(--sw-primary); background: var(--sw-bg-alt); }
.sw-toc a.is-active {
	color: var(--sw-ink); font-weight: 650;
	border-left-color: var(--sw-accent);
	background: var(--sw-bg-alt);
}
.sw-toc .sw-toc-h3 { padding-left: 2rem; font-size: .88rem; }
.sw-toc .sw-toc-h4 { padding-left: 2.9rem; font-size: .86rem; }

/* Long lists scroll inside the card instead of running down the whole page */
.sw-toc-scroll .sw-toc-panel {
	max-height: 40vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}
.sw-toc-scroll .sw-toc-panel::-webkit-scrollbar { width: 8px; }
.sw-toc-scroll .sw-toc-panel::-webkit-scrollbar-track { background: var(--sw-bg-alt); }
.sw-toc-scroll .sw-toc-panel::-webkit-scrollbar-thumb {
	background: var(--sw-line); border-radius: 4px;
}
.sw-toc-scroll .sw-toc-panel::-webkit-scrollbar-thumb:hover { background: var(--sw-ink-mute); }

/* One TOC per screen.
   Desktop: the sidebar carries it, so the inline copy is redundant.
   Mobile: the sidebar stacks under the article, so its TOC would appear a
   second time at the bottom. Hide it there and keep the inline one at the top. */
@media (min-width: 1024px) {
	body.sw-sidebar-toc .sw-toc-inline { display: none; }
}
@media (max-width: 1023px) {
	.sw-toc-sidebar { display: none; }
}

/* TOC drawer (opened by the floating button) */
.sw-toc-drawer {
	position: fixed; z-index: 130; right: 0; top: 0; bottom: 0; width: min(340px, 88vw);
	background: var(--sw-bg); border-left: 1px solid var(--sw-line); box-shadow: var(--sw-shadow-lg);
	transform: translateX(100%); transition: transform .22s ease;
	overflow-y: auto; padding: 1.15rem;
}
.sw-toc-drawer.is-open { transform: translateX(0); }
.sw-toc-drawer .sw-toc { background: none; border: 0; margin: 0; overflow: visible; }
.sw-toc-drawer .sw-toc-panel { border-top: 0; background: none; }
.sw-drawer-close { position: absolute; top: .75rem; right: .75rem; }
.sw-overlay {
	position: fixed; inset: 0; background: rgba(20, 32, 28, .45); z-index: 125;
	opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s;
}
.sw-overlay.is-open { opacity: 1; visibility: visible; }

/* Back to top — desktop only, appears after one screen of scrolling */
.sw-to-top {
	display: none;
	position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 95;
	width: 44px; height: 44px; padding: 0;
	align-items: center; justify-content: center;
	color: #fff; background: var(--sw-ink); border: 0;
	border-radius: 50%; box-shadow: var(--sw-shadow-lg); cursor: pointer;
	opacity: 0; transform: translateY(8px);
	transition: opacity .18s ease, transform .18s ease, background .18s ease;
}
.sw-to-top svg { width: 20px; height: 20px; }
.sw-to-top:hover { background: var(--sw-primary); }
.sw-to-top.is-visible { opacity: 1; transform: translateY(0); }

@media (min-width: 1024px) {
	.sw-to-top:not([hidden]) { display: flex; }
}

/* ==========================================================================
   8. Sidebar
   ========================================================================== */

.sw-sidebar { min-width: 0; }
@media (min-width: 1024px) {
	.sw-sidebar-sticky { position: sticky; top: calc(var(--sw-header-h) + 1.25rem); }
}

.sw-widget {
	margin-bottom: 1.5rem; padding: 1.15rem;
	background: var(--sw-bg); border: 1px solid var(--sw-line); border-radius: var(--sw-radius);
}
.sw-widget:last-child { margin-bottom: 0; }
.sw-widget-title {
	font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
	color: var(--sw-ink-soft); margin: 0 0 .85rem;
}
.sw-widget ul { list-style: none; margin: 0; padding: 0; }
.sw-widget li { margin-bottom: .5rem; font-size: .92rem; }
.sw-widget li:last-child { margin-bottom: 0; }
.sw-widget a { color: var(--sw-ink-soft); text-decoration: none; }
.sw-widget a:hover { color: var(--sw-primary); }

/* Sidebar in TOC-only mode has no card chrome */
.sw-sidebar-toc-only .sw-toc { position: static; }

/* ==========================================================================
   9. Cards / archive grid
   ========================================================================== */

.sw-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }

.sw-card {
	display: flex; flex-direction: column; overflow: hidden;
	background: var(--sw-bg); border: 1px solid var(--sw-line); border-radius: var(--sw-radius);
	transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.sw-card:hover { border-color: var(--sw-primary); box-shadow: var(--sw-shadow); transform: translateY(-2px); }
.sw-card-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--sw-bg-alt); }
.sw-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sw-card-body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; flex: 1; }
.sw-card-cat {
	font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
	color: var(--sw-primary); text-decoration: none; margin-bottom: .35rem;
}
.sw-card-cat:hover { color: var(--sw-primary-dark); }
.sw-card-title { font-size: 1.02rem; line-height: 1.35; margin: 0 0 .4rem; font-weight: 650; }
.sw-card-title a { color: var(--sw-ink); text-decoration: none; }
.sw-card-title a:hover { color: var(--sw-primary); }
.sw-card-excerpt { font-size: .88rem; color: var(--sw-ink-mute); line-height: 1.55; margin: 0 0 .7rem; }
.sw-card-meta { margin-top: auto; font-size: .76rem; color: var(--sw-ink-mute); }

/* Compact list variant */
.sw-list { display: flex; flex-direction: column; gap: .85rem; }
.sw-list-item { display: flex; gap: .85rem; align-items: flex-start; }
.sw-list-thumb { flex: 0 0 84px; aspect-ratio: 4 / 3; border-radius: var(--sw-radius-sm); overflow: hidden; background: var(--sw-bg-alt); }
.sw-list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sw-list-title { font-size: .93rem; line-height: 1.4; margin: 0 0 .2rem; font-weight: 600; }
.sw-list-title a { color: var(--sw-ink); text-decoration: none; }
.sw-list-title a:hover { color: var(--sw-primary); }
.sw-list-meta { font-size: .76rem; color: var(--sw-ink-mute); }

/* ==========================================================================
   10. Related posts
   ========================================================================== */

.sw-related { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 2px solid var(--sw-line); }
.sw-related-title { font-size: 1.15rem; margin: 0 0 1.15rem; }
.sw-related .sw-grid { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 1rem; }
.sw-related .sw-card-title { font-size: .95rem; }

/* ==========================================================================
   11. Homepage
   ========================================================================== */

.sw-hero {
	background: linear-gradient(168deg, var(--sw-primary-light) 0%, var(--sw-bg) 72%);
	border-bottom: 1px solid var(--sw-line);
	padding: 2.75rem 0 2.25rem;
}
.sw-hero-inner { max-width: 780px; margin: 0 auto; text-align: center; padding: 0 1.15rem; }
.sw-hero-eyebrow {
	display: inline-flex; align-items: center; gap: .4rem;
	font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
	color: var(--sw-primary); background: var(--sw-bg); border: 1px solid var(--sw-primary);
	padding: .3rem .75rem; border-radius: 100px; margin-bottom: 1rem;
}
.sw-hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 .75rem; letter-spacing: -.025em; }
.sw-hero-sub { font-size: clamp(1rem, 2.4vw, 1.12rem); color: var(--sw-ink-soft); margin: 0 auto 1.5rem; max-width: 620px; }
.sw-hero-search { max-width: 480px; margin: 0 auto; }
.sw-hero-note { font-size: .8rem; color: var(--sw-ink-mute); margin-top: .85rem; }

.sw-section { padding: 2.5rem 0; }
.sw-section-alt { background: var(--sw-bg-alt); }
.sw-section-head { text-align: center; max-width: 620px; margin: 0 auto 1.75rem; }
.sw-section-head h2 { margin: 0 0 .4rem; }
.sw-section-head p { color: var(--sw-ink-soft); margin: 0; font-size: .96rem; }

/* Condition tiles — the primary homepage navigation */
.sw-tiles { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.sw-tile {
	display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem;
	background: var(--sw-bg); border: 1px solid var(--sw-line); border-radius: var(--sw-radius);
	text-decoration: none; color: var(--sw-ink); font-weight: 600; font-size: .95rem;
	transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.sw-tile:hover { border-color: var(--sw-primary); box-shadow: var(--sw-shadow); transform: translateY(-2px); color: var(--sw-primary); }
.sw-tile-icon {
	flex: 0 0 34px; height: 34px; display: grid; place-items: center;
	background: var(--sw-primary-light); color: var(--sw-primary); border-radius: 8px;
}
.sw-tile-icon svg { width: 18px; height: 18px; }
.sw-tile-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sw-tile-count { font-size: .74rem; font-weight: 500; color: var(--sw-ink-mute); }

/* Trust strip */
.sw-trust { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.sw-trust-item { text-align: center; }
.sw-trust-icon {
	width: 40px; height: 40px; margin: 0 auto .6rem; display: grid; place-items: center;
	background: var(--sw-accent-light); color: var(--sw-accent-dark); border-radius: 50%;
}
.sw-trust-icon svg { width: 20px; height: 20px; }
.sw-trust-item h3 { font-size: 1rem; margin: 0 0 .3rem; }
.sw-trust-item p { font-size: .88rem; color: var(--sw-ink-mute); margin: 0; }

/* ==========================================================================
   12. Content callouts (safety verdicts) — shortcodes
   ========================================================================== */

.sw-callout {
	border-left: 4px solid var(--sw-primary); background: var(--sw-primary-light);
	padding: .95rem 1.1rem; border-radius: 0 var(--sw-radius-sm) var(--sw-radius-sm) 0;
	margin: 1.5rem 0;
}
.sw-callout > *:last-child { margin-bottom: 0; }
.sw-callout-label {
	display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase;
	letter-spacing: .07em; margin-bottom: .3rem;
}
.sw-callout-safe { border-color: var(--sw-safe); background: var(--sw-safe-bg); }
.sw-callout-safe .sw-callout-label { color: var(--sw-safe); }
.sw-callout-caution { border-color: var(--sw-caution); background: var(--sw-caution-bg); }
.sw-callout-caution .sw-callout-label { color: var(--sw-caution); }
.sw-callout-avoid { border-color: var(--sw-avoid); background: var(--sw-avoid-bg); }
.sw-callout-avoid .sw-callout-label { color: var(--sw-avoid); }

/* Short answer block — the Representative Answer */
.sw-answer {
	background: var(--sw-primary-light); border: 1px solid var(--sw-primary);
	border-radius: var(--sw-radius); padding: 1.15rem 1.25rem; margin: 0 0 1.75rem;
}
.sw-answer-label {
	display: inline-block; font-size: .7rem; font-weight: 800; text-transform: uppercase;
	letter-spacing: .08em; color: var(--sw-primary); margin-bottom: .4rem;
}
.sw-answer p { margin: 0; font-size: 1.05rem; line-height: 1.6; }

/* Medical disclaimer */
.sw-disclaimer {
	font-size: .84rem; color: var(--sw-ink-mute); background: var(--sw-bg-alt);
	border: 1px solid var(--sw-line); border-radius: var(--sw-radius);
	padding: .9rem 1.05rem; margin: 2rem 0 0;
}
.sw-disclaimer strong { color: var(--sw-ink-soft); }

/* ==========================================================================
   13. Amazon product box
   ========================================================================== */

.sw-product {
	display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: center;
	border: 1px solid var(--sw-line); border-radius: var(--sw-radius);
	padding: 1.1rem; margin: 1.75rem 0; background: var(--sw-bg);
}
@media (min-width: 560px) { .sw-product { grid-template-columns: 128px 1fr auto; } }
.sw-product-img { width: 128px; margin: 0 auto; }
.sw-product-img img { border-radius: var(--sw-radius-sm); }
.sw-product-name { font-size: 1.02rem; font-weight: 650; margin: 0 0 .3rem; }
.sw-product-desc { font-size: .88rem; color: var(--sw-ink-mute); margin: 0; }
.sw-product-cta { text-align: center; }
.sw-product-note { font-size: .72rem; color: var(--sw-ink-mute); margin-top: .4rem; }
.sw-affiliate-note {
	font-size: .8rem; color: var(--sw-ink-mute); font-style: italic;
	border-top: 1px dashed var(--sw-line); padding-top: .7rem; margin-top: 1.5rem;
}

/* ==========================================================================
   14. Ad slots — height reserved so ads never cause layout shift
   ========================================================================== */

.sw-ad { margin: 1.75rem 0; text-align: center; overflow: hidden; }
.sw-ad::before {
	content: "Advertisement"; display: block;
	font-size: .64rem; text-transform: uppercase; letter-spacing: .09em;
	color: var(--sw-ink-mute); opacity: .65; margin-bottom: .35rem;
}
.sw-ad-inner { margin: 0 auto; }
.sw-ad-top .sw-ad-inner { min-height: 100px; }
.sw-ad-mid .sw-ad-inner { min-height: 250px; }
.sw-ad-bottom .sw-ad-inner { min-height: 250px; }
.sw-ad-sidebar .sw-ad-inner { min-height: 600px; }
@media (max-width: 767px) {
	.sw-ad-top .sw-ad-inner { min-height: 100px; }
	.sw-ad-mid .sw-ad-inner,
	.sw-ad-bottom .sw-ad-inner { min-height: 280px; }
}
.sw-ad-sidebar { margin: 0 0 1.5rem; }

/* Banner rails — only when the sidebar is off and the screen is wide enough
   that they cannot crowd the text column. */
.sw-ad-rail { display: none; }

@media (min-width: 1440px) {
	body.sw-no-sidebar .sw-ad-rail {
		display: block;
		position: fixed;
		top: calc(var(--sw-header-h) + 2rem);
		width: 160px;
		z-index: 50;
	}
	body.sw-no-sidebar .sw-ad-rail-left  { right: calc(50% + 440px); }
	body.sw-no-sidebar .sw-ad-rail-right { left:  calc(50% + 440px); }
	.sw-ad-rail .sw-ad { margin: 0; }
	.sw-ad-rail .sw-ad-inner { min-height: 600px; }
}

@media (min-width: 1680px) {
	body.sw-no-sidebar .sw-ad-rail { width: 300px; }
	body.sw-no-sidebar .sw-ad-rail-left  { right: calc(50% + 460px); }
	body.sw-no-sidebar .sw-ad-rail-right { left:  calc(50% + 460px); }
}

/* ==========================================================================
   15. Pagination, comments, footer
   ========================================================================== */

.sw-pagination { margin-top: 2.5rem; display: flex; justify-content: center; }
.sw-pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 38px; height: 38px; padding: 0 .6rem; margin: 0 .15rem;
	border: 1px solid var(--sw-line); border-radius: var(--sw-radius-sm);
	color: var(--sw-ink-soft); text-decoration: none; font-size: .9rem;
}
.sw-pagination .page-numbers:hover { border-color: var(--sw-primary); color: var(--sw-primary); }
.sw-pagination .page-numbers.current { background: var(--sw-primary); border-color: var(--sw-primary); color: #fff; }
.sw-pagination .dots { border-color: transparent; }

.sw-comments { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 1px solid var(--sw-line); }
.sw-comments ol.comment-list { list-style: none; padding: 0; margin: 0; }
.sw-comments ol.children { list-style: none; padding-left: 1.5rem; }
.sw-comments .comment-body { padding: 1rem 0; border-bottom: 1px solid var(--sw-line-soft); }
.sw-comments .comment-author { font-weight: 600; font-size: .92rem; }
.sw-comments .comment-author img { border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: .5rem; }
.sw-comments .comment-metadata { font-size: .78rem; color: var(--sw-ink-mute); margin-bottom: .5rem; }
.sw-comments .reply { font-size: .82rem; }

.sw-footer {
	background: var(--sw-bg-alt); border-top: 1px solid var(--sw-line);
	padding: 2.5rem 0 1.5rem; margin-top: 3rem; font-size: .9rem;
}
.sw-footer-grid { display: grid; gap: 1.75rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 2rem; }
.sw-footer-col h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sw-ink-soft); margin: 0 0 .7rem; }
.sw-footer-col ul { list-style: none; margin: 0; padding: 0; }
.sw-footer-col li { margin-bottom: .4rem; }
.sw-footer-col a { color: var(--sw-ink-mute); text-decoration: none; }
.sw-footer-col a:hover { color: var(--sw-primary); }
.sw-footer-about p { color: var(--sw-ink-mute); margin: 0; font-size: .87rem; }
/* Legal strip: affiliate disclosure + medical disclaimer, sitewide */
.sw-footer-legal {
	border-top: 1px solid var(--sw-line);
	padding-top: 1.15rem; margin-bottom: 1.15rem;
	display: grid; gap: .55rem;
}
.sw-legal-item {
	margin: 0; font-size: .82rem; line-height: 1.6; color: var(--sw-ink-mute);
}
.sw-legal-item strong { color: var(--sw-ink-soft); font-weight: 650; }

.sw-footer-bottom {
	border-top: 1px solid var(--sw-line); padding-top: 1.15rem;
	display: flex; flex-wrap: wrap; gap: .6rem 1.25rem; justify-content: space-between;
	font-size: .82rem; color: var(--sw-ink-mute);
}
.sw-footer-bottom a { color: var(--sw-ink-mute); }
.sw-footer-nav { display: flex; flex-wrap: wrap; gap: .5rem 1rem; list-style: none; margin: 0; padding: 0; }

/* ==========================================================================
   16. 404 / no results
   ========================================================================== */

.sw-empty { text-align: center; padding: 3rem 1rem; max-width: 520px; margin: 0 auto; }
.sw-empty h1 { font-size: clamp(2.2rem, 7vw, 3.2rem); color: var(--sw-primary); margin-bottom: .35rem; }
.sw-empty p { color: var(--sw-ink-soft); }
.sw-empty .sw-search-form { margin-top: 1.5rem; }

/* ==========================================================================
   17. WordPress core classes
   ========================================================================== */

.alignleft { float: left; margin: .35rem 1.5rem 1rem 0; }
.alignright { float: right; margin: .35rem 0 1rem 1.5rem; }
.aligncenter { margin-left: auto; margin-right: auto; }
.alignwide { max-width: min(1080px, 100%); margin-left: auto; margin-right: auto; }
/* 100vw includes the scrollbar and would overflow; stay inside the container. */
.alignfull { width: 100%; max-width: 100%; margin-left: 0; margin-right: 0; }
.sticky .sw-card { border-color: var(--sw-accent); }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: .83rem; color: var(--sw-ink-mute); text-align: center; }
.gallery { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.gallery-item { margin: 0; }
.wp-block-image img { border-radius: var(--sw-radius); }
.says, .bypostauthor { display: inherit; }

/* ==========================================================================
   18. Mobile touch targets
   ========================================================================== */

@media (max-width: 767px) {
	/* Give list-style links a comfortable tap area without changing the look. */
	.sw-footer-col li a,
	.sw-footer-nav a,
	.sw-widget li a,
	.sw-toc a {
		display: inline-block;
		padding-top: .35rem;
		padding-bottom: .35rem;
	}

	.sw-card-cat { padding: .2rem 0; }

	.sw-icon-btn { width: 40px; height: 40px; }

	/* Slightly larger body text on small screens aids readability. */
	body { font-size: 1.0625rem; }
}

@media print {
	.sw-header, .sw-footer, .sw-sidebar, .sw-ad, .sw-related, .sw-toc-toggle, .sw-toc-drawer, .sw-comments { display: none !important; }
	body { font-size: 12pt; }
}
