/* Snoozz Post Layout: front end */

:root {
	--snz-accent: #3b4fa8;
	--snz-accent-soft: rgba(59, 79, 168, 0.08);
	--snz-border: rgba(0, 0, 0, 0.12);
	--snz-muted: rgba(0, 0, 0, 0.6);
	--snz-radius: 10px;
	--bed-bg: #17140f;
	--bed-surface: #211c15;
	--bed-fg: #e8dcc5;
	--bed-muted: #b3a68f;
	--bed-link: #f0b86e;
	--bed-border: rgba(232, 220, 197, 0.16);
}

/* ---------- Header: badge, tools, contents ---------- */

.snz-header { margin: 0 0 1.75em; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75em; max-width: 100%; }
.snz-header > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
.snz-header *, .snz-header *::before, .snz-header *::after { box-sizing: border-box; }
.snz-badge > span { min-width: 0; overflow-wrap: anywhere; }

/* Fixed icon sizes, so theme rules like svg { width: 100% } can't stretch them */
.snz-badge-icon { width: 18px !important; height: 18px !important; flex: none; }
.snz-listen-hp { width: 24px !important; height: 24px !important; flex: none; }
.snz-follow svg { width: 20px !important; height: 20px !important; flex: none; }
.snz-moon svg { width: 22px !important; height: 22px !important; }

/* Keep the listen bar inside the screen no matter how the theme styles buttons and dropdowns */
.snz-listen button, .snz-listen select { min-width: 0 !important; width: auto !important; height: auto !important; max-width: none; margin: 0 !important; float: none !important; }
.snz-listen-play { white-space: normal !important; }
.snz-listen-speed { flex: none; margin: 0 !important; }
.snz-listen-speed select { width: auto !important; max-width: 76px !important; display: inline-block !important; }
.snz-listen-stop { flex: none; }
@media (max-width: 480px) {
	.snz-listen { padding: 0.4em 0.7em 0.4em 0.4em; gap: 0.45em; }
	.snz-listen-label { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; line-height: 1.25; font-size: 0.875rem; }
	.snz-listen-circle { width: 36px; height: 36px; }
	.snz-listen-hp { width: 20px !important; height: 20px !important; }
	.snz-badge { grid-template-columns: auto minmax(0, 1fr) !important; }
	.snz-badge-date { grid-column: 2; white-space: normal; }
}

.snz-badge {
	display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.25em 0.6em;
	font-size: 0.875rem; line-height: 1.4;
	padding: 0.6em 0.85em; border-radius: var(--snz-radius);
	background: var(--snz-accent-soft); color: inherit;
}
.snz-badge-icon { color: var(--snz-accent); flex: none; }
.snz-badge a { color: var(--snz-accent); font-weight: 600; text-decoration: none; }
.snz-badge a:hover { text-decoration: underline; }
.snz-badge-cred { opacity: 0.8; }
.snz-badge-date { color: var(--snz-muted); white-space: nowrap; }

.snz-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em; font-size: 0.875rem; }
.snz-readtime { color: var(--snz-muted); margin-right: 0.5em; }

/* First posted / Revised */
.snz-dates { display: flex; flex-wrap: wrap; gap: 0.25em 1.25em; font-size: 0.8125rem; color: var(--snz-muted); margin-top: -0.35em; }
.snz-date-item time { font-weight: 600; color: inherit; }

/* Topic tags under the title */
.snz-terms { display: flex; flex-wrap: wrap; gap: 0.4em; }
.snz-term {
	display: inline-block; padding: 0.3em 0.8em; border-radius: 999px;
	font-size: 0.8125rem; font-weight: 600; line-height: 1.3; text-decoration: none !important;
	background: var(--snz-accent-soft); color: var(--snz-accent) !important; box-shadow: none !important;
}
.snz-term:hover { background: var(--snz-accent); color: #fff !important; }

/* Listen bar: full width, black, headphones at the end */
.snz-listen {
	display: flex; align-items: center; gap: 0.6em; width: 100%; box-sizing: border-box;
	padding: 0.5em 1em 0.5em 0.5em; border-radius: 999px;
	background: #000; color: #fff;
}
.snz-listen[hidden], .snz-listen-stop[hidden] { display: none !important; }
.snz-listen button {
	appearance: none; -webkit-appearance: none; border: 0 !important; box-shadow: none !important;
	background: transparent !important; color: inherit !important; font: inherit; cursor: pointer;
	text-transform: none; letter-spacing: normal; margin: 0;
}
.snz-listen-play { flex: 1; min-width: 0; display: flex !important; align-items: center; gap: 0.75em; padding: 0 !important; text-align: left; min-height: 44px; }
.snz-listen-circle {
	display: inline-flex; align-items: center; justify-content: center; flex: none;
	width: 40px; height: 40px; border-radius: 50%; background: #fff; color: #000;
}
.snz-listen-circle .snz-ico-play { margin-left: 3px; }
.is-playing .snz-listen-circle .snz-ico-play { margin-left: 0; }
.snz-listen-label { font-size: 0.9375rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .snz-listen-label { font-size: 0.875rem; } .snz-listen { gap: 0.4em; } }
.snz-listen-stop { padding: 0.5em !important; display: inline-flex; }
.snz-listen-stop .snz-ico-stop { width: 12px; height: 12px; }
.snz-listen-speed select {
	font: inherit; font-size: 0.8125rem; min-height: 32px; padding: 0 0.4em;
	border: 1px solid rgba(255,255,255,0.35) !important; border-radius: 999px;
	background: #000 !important; color: #fff !important;
}
.snz-listen-hp { flex: none; color: #fff; opacity: 0.9; }
.snz-listen.is-active .snz-listen-hp { animation: snz-pulse 1.6s ease-in-out infinite; }
.snz-listen-play:focus-visible, .snz-listen-stop:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 999px; }

.snz-btn {
	display: inline-flex; align-items: center; gap: 0.4em;
	font: inherit; font-size: 0.875rem; line-height: 1;
	padding: 0.5em 0.85em; min-height: 36px;
	border: 1px solid var(--snz-border); border-radius: 999px;
	background: transparent; color: inherit; cursor: pointer;
	text-transform: none; letter-spacing: normal; font-weight: 500; box-shadow: none;
}
.snz-btn:hover { border-color: var(--snz-accent); color: var(--snz-accent); }
.snz-btn:focus-visible { outline: 2px solid var(--snz-accent); outline-offset: 2px; }
.snz-listen-stop { padding: 0.5em 0.65em; }


.snz-ico-play, .snz-ico-stop, .snz-ico-moon { display: inline-block; width: 12px; height: 12px; flex: none; }
.snz-ico-play { border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; width: 0; height: 0; }
.is-playing .snz-ico-play { border: 0; width: 10px; height: 12px; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
.snz-ico-stop { width: 10px; height: 10px; background: currentColor; border-radius: 1px; }
.snz-ico-moon { border-radius: 50%; box-shadow: inset -4px -2px 0 0 currentColor; transform: rotate(-20deg); }

.snz-reading { background: var(--snz-accent-soft); border-radius: 4px; box-shadow: 0 0 0 4px var(--snz-accent-soft); transition: background 0.2s; }

.snz-toc { border: 1px solid var(--snz-border); border-radius: var(--snz-radius); padding: 0.6em 1em; font-size: 0.9375rem; }
.snz-toc summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.snz-toc summary::-webkit-details-marker { display: none; }
.snz-toc-arrow {
	flex: none; width: 28px; height: 28px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--snz-accent); color: #fff;
	animation: snz-glow 1.8s ease-in-out infinite;
}
.snz-toc-arrow::before {
	content: ''; width: 7px; height: 7px; margin-top: -4px;
	border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
	transition: transform 0.25s, margin 0.25s;
}
.snz-toc[open] .snz-toc-arrow { animation: none; }
.snz-toc[open] .snz-toc-arrow::before { transform: rotate(-135deg); margin-top: 4px; }
.snz-toc ol { margin: 0.6em 0 0.2em; padding-left: 1.2em; }
.snz-toc li { margin: 0.35em 0; }
.snz-toc .snz-toc-h3 { margin-left: 1em; list-style-type: circle; }
.snz-toc a { text-decoration: none; display: inline-flex; align-items: center; gap: 0.5em; }
.snz-toc a:hover span:first-child { text-decoration: underline; }
.snz-toc-go {
	display: inline-block; width: 6px; height: 6px; margin-top: -3px;
	border-right: 2px solid var(--snz-accent); border-bottom: 2px solid var(--snz-accent);
	transform: rotate(45deg); animation: snz-nudge 1.8s ease-in-out infinite;
	filter: drop-shadow(0 0 3px var(--snz-accent));
}
@keyframes snz-glow {
	0%, 100% { box-shadow: 0 0 0 0 rgba(59, 79, 168, 0.55); }
	50% { box-shadow: 0 0 0 7px rgba(59, 79, 168, 0); }
}
@keyframes snz-nudge {
	0%, 100% { transform: translateY(0) rotate(45deg); opacity: 0.6; }
	50% { transform: translateY(3px) rotate(45deg); opacity: 1; }
}
@keyframes snz-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

html:has(.snz-article) { scroll-behavior: smooth; }

/* Justified article text */
.snz-justify .snz-article-body > p,
.snz-justify .snz-article-body li { text-align: justify; -webkit-hyphens: auto; hyphens: auto; }

/* References */
.snz-ref-hidden { display: none !important; }
.snz-refs-toggle {
	appearance: none; -webkit-appearance: none; display: inline-flex; align-items: center; gap: 0.5em;
	margin: 0.5em 0 1em; padding: 0.55em 1.1em; min-height: 40px;
	font: inherit; font-size: 0.875rem; font-weight: 600; text-transform: none; letter-spacing: normal;
	border: 1px solid var(--snz-border) !important; border-radius: 999px; box-shadow: none !important;
	background: transparent !important; color: var(--snz-accent) !important; cursor: pointer;
}
.snz-refs-toggle::after {
	content: ''; width: 6px; height: 6px; margin-top: -3px;
	border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.snz-refs-toggle[aria-expanded="true"]::after { transform: rotate(-135deg); margin-top: 3px; }

/* Moon icon next to the title while bedtime mode is on */
.snz-moon {
	appearance: none; -webkit-appearance: none; display: inline-flex; vertical-align: middle;
	margin-left: 0.35em; padding: 0.15em !important; border: 0 !important; box-shadow: none !important;
	background: transparent !important; color: #f0b86e !important; cursor: pointer; line-height: 1;
	filter: drop-shadow(0 0 6px rgba(240, 184, 110, 0.6));
}
.snz-moon[hidden] { display: none !important; }

.snz-article-body :is(h2, h3)[id] { scroll-margin-top: 80px; }

/* ---------- Ads ---------- */

.snz-ad { margin: 2em auto; text-align: center; clear: both; }
.snz-ad-label {
	display: block; margin-bottom: 0.4em;
	font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase;
	color: var(--snz-muted);
}
.snz-ad-body {
	min-height: var(--snz-ad-h, 250px);
	max-width: min(100%, var(--snz-ad-w, 100%));
	margin: 0 auto;
	display: flex; align-items: center; justify-content: center;
}
.snz-ad-body > * { max-width: 100%; }
.snz-ad-body img, .snz-ad-img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.snz-ad--banner .snz-ad-body { min-height: 0; aspect-ratio: auto; }
.snz-ad--banner .snz-ad-body:empty, .snz-ad--banner .snz-ad-body:has(> template) { min-height: var(--snz-ad-h, 250px); }

.snz-anchor { display: block; height: 0; }

/* ---------- Video ---------- */

.snz-video { margin: 0 0 1.5em; }
.snz-video--inline { margin: 1.75em 0; }
.snz-video--youtube.is-wide { aspect-ratio: 16 / 9; }
.snz-video--youtube.is-vertical { aspect-ratio: 9 / 16; max-width: 360px; margin-left: auto; margin-right: auto; }
.snz-video--instagram { min-height: 480px; display: flex; justify-content: center; }
.snz-video--instagram .instagram-media { margin: 0 auto !important; min-width: 0 !important; width: 100% !important; max-width: 540px !important; }

.snz-yt, .snz-yt-frame {
	position: relative; display: block; width: 100%; height: 100%;
	border: 0 !important; padding: 0 !important; margin: 0; border-radius: var(--snz-radius);
	overflow: hidden; background: #000 !important; cursor: pointer; box-shadow: none !important;
	appearance: none; -webkit-appearance: none;
}
.snz-yt img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.92; transition: opacity 0.2s; }
.snz-yt:hover img { opacity: 1; }
.snz-yt-play {
	position: absolute; top: 50%; left: 50%; width: 68px; height: 48px;
	transform: translate(-50%, -50%); border-radius: 14px; background: rgba(20, 20, 20, 0.8);
	transition: background 0.2s;
}
.snz-yt-play::after {
	content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-35%, -50%);
	border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff;
}
.snz-yt:hover .snz-yt-play { background: #e00; }
.snz-yt:focus-visible { outline: 3px solid var(--snz-accent); outline-offset: 2px; }

/* ---------- Follow button ---------- */

.snz-follow {
	display: flex; align-items: center; justify-content: center; gap: 0.55em;
	margin: 0.6em 0 0; padding: 0.8em 1em; border-radius: var(--snz-radius);
	background: #000; color: #fff !important; text-decoration: none !important;
	font-size: 0.9375rem; font-weight: 600; line-height: 1.2; text-align: center;
	box-shadow: none !important; transition: background 0.2s;
}
.snz-follow:hover, .snz-follow:focus-visible { background: #222; color: #fff !important; }
.snz-follow:focus-visible { outline: 2px solid var(--snz-accent); outline-offset: 2px; }
.snz-follow svg { flex: none; }
.snz-video-wrap { margin: 0 0 1.5em; }
.snz-video-wrap--inline { margin: 1.75em 0; }
.snz-video-wrap .snz-video { margin: 0; }

/* ---------- Sidebar ---------- */

.snz-sidebar { display: block; }
.snz-sidebar .snz-ad { margin: 0 auto 1em; }
.snz-sidebar .snz-ad--sidebar .snz-ad-body { --snz-ad-w: 300px; }
.snz-sticky { will-change: transform; position: relative; z-index: 2; }

/* ---------- Related posts ---------- */

.snz-related { margin: 2.5em 0 1em; padding-top: 1.5em; border-top: 1px solid var(--snz-border); }
.snz-related-title { font-size: 1.25rem; margin: 0 0 0.85em; }
.snz-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1em; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.snz-related li { margin: 0; }
.snz-related a { display: grid; gap: 0.5em; text-decoration: none; color: inherit; }
.snz-related a:hover .snz-rel-title { text-decoration: underline; }
.snz-rel-thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--snz-radius); display: block; }
.snz-rel-title { font-weight: 600; line-height: 1.35; font-size: 0.975rem; }

/* ---------- Progress bar ---------- */

.snz-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 99998; pointer-events: none; }
.snz-progress span { display: block; height: 100%; background: var(--snz-accent); transform-origin: 0 50%; transform: scaleX(0); }
.admin-bar .snz-progress { top: 32px; }
@media (max-width: 782px) { .admin-bar .snz-progress { top: 46px; } }

/* ---------- Bedtime reading mode ---------- */

html.snz-bedtime { color-scheme: dark; }
html.snz-bedtime body { background: var(--bed-bg) !important; color: var(--bed-fg) !important; }
html.snz-bedtime body :where(div, section, article, aside, main, header, footer, nav, ul, ol, li, p, span, table, tr, td, th, blockquote, figure, figcaption, details, summary, h1, h2, h3, h4, h5, h6, form):not(.snz-ad-body *, .snz-yt *, .snz-video *, .snz-progress, .snz-progress *) {
	background-color: transparent !important;
	color: inherit !important;
	border-color: var(--bed-border) !important;
}
html.snz-bedtime body .snz-ico-play { border-color: transparent transparent transparent currentColor !important; }
html.snz-bedtime body .is-playing .snz-ico-play { border-color: currentColor !important; }
html.snz-bedtime body a:not(.snz-ad a, .snz-btn, .snz-follow, .snz-term) { color: var(--bed-link) !important; }
html.snz-bedtime body :is(input, select, textarea, button):not(.snz-yt, .snz-listen *, .snz-moon, .snz-refs-toggle) { background-color: var(--bed-surface) !important; color: var(--bed-fg) !important; border-color: var(--bed-border) !important; }
html.snz-bedtime body .snz-article-body { font-size: 1.12em; line-height: 1.8; }
html.snz-bedtime body .snz-article-body img:not(.snz-ad img), html.snz-bedtime body .snz-rel-thumb img { filter: brightness(0.82); }
html.snz-bedtime body .snz-badge { background: var(--bed-surface) !important; }
html.snz-bedtime body .snz-badge a, html.snz-bedtime body .snz-badge-icon { color: var(--bed-link) !important; }
html.snz-bedtime body .snz-dates, html.snz-bedtime body .snz-badge-date, html.snz-bedtime body .snz-readtime, html.snz-bedtime body .snz-ad-label { color: var(--bed-muted) !important; }
html.snz-bedtime body .snz-btn { border-color: var(--bed-border) !important; color: var(--bed-fg) !important; background: transparent !important; }
html.snz-bedtime body .snz-btn:hover, html.snz-bedtime body .snz-bedtime-toggle[aria-pressed="true"] { border-color: var(--bed-link) !important; color: var(--bed-link) !important; }
html.snz-bedtime body .snz-reading { background: rgba(240, 184, 110, 0.12) !important; box-shadow: 0 0 0 4px rgba(240, 184, 110, 0.12); }
html.snz-bedtime body .snz-progress span { background: var(--bed-link); }
html.snz-bedtime body .snz-ad { opacity: 0.85; }
html.snz-bedtime body .snz-listen { background: #000 !important; color: #fff !important; }
html.snz-bedtime body .snz-listen-circle { background: #f0b86e !important; color: #000 !important; }
html.snz-bedtime body .snz-follow { background: #000 !important; color: #fff !important; border: 1px solid var(--bed-border); }
html.snz-bedtime body .snz-term { background: var(--bed-surface) !important; color: var(--bed-link) !important; }
html.snz-bedtime body .snz-toc-arrow { background: var(--bed-link) !important; color: #000 !important; }
html.snz-bedtime body .snz-toc-go { border-color: var(--bed-link) !important; filter: drop-shadow(0 0 3px var(--bed-link)); }
html.snz-bedtime body .snz-refs-toggle { color: var(--bed-link) !important; border-color: var(--bed-border) !important; }

@media (prefers-reduced-motion: reduce) {
	.snz-yt img, .snz-yt-play, .snz-reading, .snz-toc-arrow::before { transition: none; }
	.snz-toc-arrow, .snz-toc-go, .snz-listen.is-active .snz-listen-hp { animation: none; }
	html:has(.snz-article) { scroll-behavior: auto; }
}

@media (max-width: 600px) {
	.snz-badge { grid-template-columns: auto 1fr; }
	.snz-badge-date { grid-column: 2; }
	.snz-tools .snz-btn span:last-child { font-size: 0.8125rem; }
}

/* Theme-proof button sizing */
.snz-btn { width: auto !important; min-width: 0 !important; height: auto !important; white-space: nowrap; }
