/**
 * 0xsp Reader+ — front-end styles
 *
 * Scoped to single posts via the `.oxr-reader` body class so the rest of
 * the site is untouched. Colours are driven by CSS custom properties; the
 * accent is injected inline from the plugin settings.
 */

.oxr-reader {
	--oxr-accent: #13b88a;
	--oxr-ink: #1d2530;
	--oxr-muted: #5b6675;
	--oxr-faint: #8a94a3;
	--oxr-line: #e6e9ee;
	--oxr-surface: #f7f8fa;
	--oxr-surface-2: #eef1f4;
	--oxr-code-bg: #0f1722;
	--oxr-code-bar: #1a2433;
	--oxr-code-ink: #e7edf5;
	--oxr-code-faint: #8da2bd;
	--oxr-measure: 44rem;
	--oxr-radius: 10px;
}

/* ------------------------------------------------------------------ *
 *  Article typography
 * ------------------------------------------------------------------ */

.oxr-typography .entry-content {
	max-width: var(--oxr-measure);
	color: var(--oxr-ink);
	font-size: clamp(1.02rem, 0.96rem + 0.3vw, 1.16rem);
	line-height: 1.75;
	letter-spacing: 0.002em;
	overflow-wrap: break-word;
}

.oxr-typography .entry-content > * + * {
	margin-top: 1.35em;
}

.oxr-typography .entry-content p {
	margin: 0 0 1.35em;
}

.oxr-typography .entry-content h2,
.oxr-typography .entry-content h3,
.oxr-typography .entry-content h4 {
	color: var(--oxr-ink);
	line-height: 1.25;
	letter-spacing: -0.01em;
	scroll-margin-top: 90px; /* clears sticky headers when jumping via TOC */
}

.oxr-typography .entry-content h2 {
	margin: 2.4em 0 0.7em;
	font-size: 1.62em;
	padding-bottom: 0.3em;
	border-bottom: 1px solid var(--oxr-line);
}

.oxr-typography .entry-content h3 {
	margin: 2em 0 0.6em;
	font-size: 1.3em;
}

.oxr-typography .entry-content h4 {
	margin: 1.7em 0 0.5em;
	font-size: 1.08em;
	color: var(--oxr-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.oxr-typography .entry-content a:not(.oxr-author-link):not(.button) {
	color: var(--oxr-accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	text-decoration-color: color-mix(in srgb, var(--oxr-accent) 40%, transparent);
	transition: text-decoration-color 0.15s ease;
}

.oxr-typography .entry-content a:not(.oxr-author-link):not(.button):hover {
	text-decoration-color: var(--oxr-accent);
}

.oxr-typography .entry-content ul,
.oxr-typography .entry-content ol {
	margin: 0 0 1.35em;
	padding-left: 1.4em;
}

.oxr-typography .entry-content li + li {
	margin-top: 0.4em;
}

.oxr-typography .entry-content blockquote {
	margin: 1.8em 0;
	padding: 0.2em 0 0.2em 1.4em;
	border-left: 3px solid var(--oxr-accent);
	color: var(--oxr-muted);
	font-style: normal;
}

.oxr-typography .entry-content blockquote p:last-child {
	margin-bottom: 0;
}

.oxr-typography .entry-content img,
.oxr-typography .entry-content figure {
	border-radius: var(--oxr-radius);
}

.oxr-typography .entry-content figcaption {
	margin-top: 0.6em;
	color: var(--oxr-faint);
	font-size: 0.86em;
	text-align: center;
}

.oxr-typography .entry-content hr {
	margin: 2.6em 0;
	border: 0;
	border-top: 1px solid var(--oxr-line);
}

/* Inline code */
.oxr-typography .entry-content :not(pre) > code {
	background: var(--oxr-surface-2);
	color: #b0306b;
	padding: 0.12em 0.4em;
	border-radius: 5px;
	font-size: 0.88em;
	word-break: break-word;
}

/* Tables */
.oxr-typography .entry-content table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.8em 0;
	font-size: 0.94em;
}

.oxr-typography .entry-content th,
.oxr-typography .entry-content td {
	padding: 0.6em 0.8em;
	border: 1px solid var(--oxr-line);
	text-align: left;
}

.oxr-typography .entry-content thead th {
	background: var(--oxr-surface);
	font-weight: 600;
}

/* Blockquote-as-callout convenience: a leading "Note:" / "Warning:" reads
   fine as-is, but a paragraph wrapped in a .oxr-callout gets the treatment. */
.oxr-typography .entry-content .oxr-callout {
	margin: 1.8em 0;
	padding: 1em 1.2em;
	background: var(--oxr-surface);
	border: 1px solid var(--oxr-line);
	border-left: 3px solid var(--oxr-accent);
	border-radius: var(--oxr-radius);
}

/* ------------------------------------------------------------------ *
 *  Reading meta
 * ------------------------------------------------------------------ */

.oxr-reading-meta {
	display: flex;
	align-items: center;
	gap: 0.55em;
	margin: 0 0 1.8em;
	color: var(--oxr-faint);
	font-size: 0.84em;
	font-weight: 500;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.oxr-reading-meta .oxr-meta-time {
	color: var(--oxr-accent);
}

/* ------------------------------------------------------------------ *
 *  Table of contents
 * ------------------------------------------------------------------ */

.oxr-toc {
	margin: 0 0 2.2em;
	padding: 1em 1.25em 1.1em;
	background: var(--oxr-surface);
	border: 1px solid var(--oxr-line);
	border-radius: var(--oxr-radius);
}

.oxr-toc-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
	color: var(--oxr-muted);
	font: inherit;
}

.oxr-toc-title {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
}

.oxr-toc-caret {
	width: 0.5em;
	height: 0.5em;
	border-right: 2px solid var(--oxr-faint);
	border-bottom: 2px solid var(--oxr-faint);
	transform: rotate(45deg);
	transition: transform 0.2s ease;
}

.oxr-toc-toggle[aria-expanded="false"] .oxr-toc-caret {
	transform: rotate(-45deg);
}

.oxr-toc-list {
	margin: 0.9em 0 0;
	padding: 0;
	list-style: none;
	counter-reset: oxr-toc;
}

.oxr-toc-list[hidden] {
	display: none;
}

.oxr-toc-item {
	margin: 0;
	line-height: 1.4;
}

.oxr-toc-item a {
	display: block;
	padding: 0.32em 0 0.32em 0.85em;
	border-left: 2px solid var(--oxr-line);
	color: var(--oxr-muted);
	text-decoration: none;
	font-size: 0.92rem;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.oxr-toc-item.oxr-toc-l3 a {
	padding-left: 1.7em;
	font-size: 0.88rem;
}

.oxr-toc-item a:hover {
	color: var(--oxr-ink);
}

.oxr-toc-item a.is-active {
	color: var(--oxr-accent);
	border-left-color: var(--oxr-accent);
	font-weight: 600;
}

/* On wide screens, float the TOC alongside the article if there's room. */
@media (min-width: 1280px) {
	.oxr-reader.oxr-toc-floating .oxr-toc {
		position: sticky;
		top: 90px;
	}
}

/* ------------------------------------------------------------------ *
 *  Code blocks (terminal style)
 * ------------------------------------------------------------------ */

.oxr-typography .entry-content pre,
.oxr-reader .oxr-code {
	position: relative;
	margin: 1.9em 0;
	background: var(--oxr-code-bg);
	border-radius: var(--oxr-radius);
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(15, 23, 34, 0.12), 0 8px 24px -16px rgba(15, 23, 34, 0.5);
}

/* When JS wraps a <pre> we add a header bar; this is the bar. */
.oxr-code-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	padding: 0.5em 0.9em;
	background: var(--oxr-code-bar);
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.oxr-code-dots {
	display: inline-flex;
	gap: 0.4em;
}

.oxr-code-dots i {
	width: 0.7em;
	height: 0.7em;
	border-radius: 50%;
	background: #3a4a60;
}

.oxr-code-lang {
	margin-left: 0.6em;
	color: var(--oxr-code-faint);
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	font-size: 0.72rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.oxr-copy {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.28em 0.7em;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 6px;
	color: var(--oxr-code-faint);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.72rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.oxr-copy:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

.oxr-copy.is-copied {
	color: var(--oxr-accent);
	border-color: color-mix(in srgb, var(--oxr-accent) 60%, transparent);
}

.oxr-typography .entry-content pre,
.oxr-typography .entry-content pre code,
.oxr-reader .oxr-code pre {
	color: var(--oxr-code-ink);
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
	font-size: 0.88rem;
	line-height: 1.6;
	tab-size: 4;
}

.oxr-typography .entry-content pre {
	padding: 1.1em 1.2em;
	overflow-x: auto;
}

/* If a header bar was added, the code padding lives on the inner pre. */
.oxr-reader .oxr-code pre {
	margin: 0;
	padding: 1.1em 1.2em;
	background: none;
	overflow-x: auto;
	box-shadow: none;
	border-radius: 0;
}

.oxr-typography .entry-content pre code {
	background: none;
	padding: 0;
	color: inherit;
	font-size: inherit;
}

/* ------------------------------------------------------------------ *
 *  Author box
 * ------------------------------------------------------------------ */

.oxr-author-box {
	display: flex;
	gap: 1.2em;
	align-items: flex-start;
	max-width: var(--oxr-measure);
	margin: 3em 0 1em;
	padding: 1.5em;
	background: var(--oxr-surface);
	border: 1px solid var(--oxr-line);
	border-radius: var(--oxr-radius);
}

.oxr-author-figure {
	flex: 0 0 auto;
}

.oxr-author-avatar {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	display: block;
}

.oxr-author-body {
	flex: 1 1 auto;
	min-width: 0;
}

.oxr-author-eyebrow {
	display: block;
	color: var(--oxr-faint);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.oxr-author-name {
	margin: 0.25em 0 0.45em;
	font-size: 1.2rem;
	line-height: 1.2;
}

.oxr-author-name a {
	color: var(--oxr-ink);
	text-decoration: none;
}

.oxr-author-name a:hover {
	color: var(--oxr-accent);
}

.oxr-author-bio {
	margin: 0 0 0.8em;
	color: var(--oxr-muted);
	font-size: 0.95rem;
	line-height: 1.6;
}

.oxr-author-links {
	display: flex;
	flex-wrap: wrap;
	gap: 1.1em;
}

.oxr-author-link {
	color: var(--oxr-accent);
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: none;
}

.oxr-author-link:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ *
 *  Reading progress bar
 * ------------------------------------------------------------------ */

.oxr-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	z-index: 9999;
	background: transparent;
	pointer-events: none;
}

.oxr-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: var(--oxr-accent);
	transition: width 0.08s linear;
}

/* ------------------------------------------------------------------ *
 *  Back-to-top
 * ------------------------------------------------------------------ */

.oxr-top {
	position: fixed;
	right: 1.4rem;
	bottom: 1.4rem;
	z-index: 9998;
	width: 2.85rem;
	height: 2.85rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--oxr-ink);
	color: #fff;
	border: 0;
	border-radius: 50%;
	font-size: 1.1rem;
	cursor: pointer;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
	box-shadow: 0 6px 20px -6px rgba(15, 23, 34, 0.5);
}

.oxr-top.is-visible {
	opacity: 1;
	transform: translateY(0);
}

.oxr-top:hover {
	background: var(--oxr-accent);
}

/* ------------------------------------------------------------------ *
 *  Motion / dark-mode niceties
 * ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.oxr-progress-fill,
	.oxr-top,
	.oxr-toc-caret,
	.oxr-toc-item a {
		transition: none;
	}
}

@media (prefers-color-scheme: dark) {
	.oxr-reader {
		--oxr-ink: #e9edf2;
		--oxr-muted: #aab4c2;
		--oxr-faint: #7f8b9b;
		--oxr-line: #2a3340;
		--oxr-surface: #161d27;
		--oxr-surface-2: #1f2733;
	}
	.oxr-typography .entry-content :not(pre) > code {
		color: #ff8bb6;
	}
}
