/**
 * CompoundWiki theme shell — header, nav, hero, lists, footer. Built on the
 * plugin's design tokens (cw-tokens.css); var() fallbacks keep the shell usable
 * even if the plugin is inactive. Mobile-first.
 */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body.cw-body {
	margin: 0;
	font-family: var(--cw-font-sans, system-ui, sans-serif);
	font-size: var(--cw-text-base, 1rem);
	line-height: var(--cw-leading, 1.6);
	color: var(--cw-text, #0f172a);
	/* One soft top glow behind the whole page — the transparent header and the
	   hero share it, so nothing "covers" the navbar and there's no hard band. */
	background:
		radial-gradient(1100px 440px at 50% -80px, rgba(14, 165, 233, 0.10) 0%, transparent 62%),
		var(--cw-bg, #f8fafc);
	background-repeat: no-repeat;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

a {
	color: var(--cw-brand-strong, #075985);
	text-decoration: none;
	transition: color var(--cw-transition, 180ms ease);
}

a:hover {
	color: var(--cw-accent, #0ea5e9);
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

.cw-site-main {
	flex: 1 0 auto;
}

/* 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;
}

.cw-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100000;
}

.cw-skip-link:focus {
	left: 8px;
	top: 8px;
	width: auto;
	height: auto;
	padding: 10px 16px;
	clip: auto;
	clip-path: none;
	background: var(--cw-surface, #fff);
	border-radius: var(--cw-radius-md, 12px);
	box-shadow: var(--cw-shadow-md);
}

:focus-visible {
	outline: 2px solid var(--cw-brand, #0369a1);
	outline-offset: 2px;
}

/* Header ------------------------------------------------------------------ */
.cw-site-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	/* Transparent at the top so the hero background flows continuously up to
	   it (no white band/gap); the frosted bar fades in once the page scrolls. */
	background: transparent;
	border-bottom: 1px solid transparent;
	transition: background var(--cw-transition, 180ms ease), border-color var(--cw-transition, 180ms ease), box-shadow var(--cw-transition, 180ms ease), backdrop-filter var(--cw-transition, 180ms ease);
}

.cw-site-header.is-scrolled {
	background: color-mix(in srgb, var(--cw-surface, #fff) 82%, transparent);
	backdrop-filter: saturate(180%) blur(12px);
	-webkit-backdrop-filter: saturate(180%) blur(12px);
	border-bottom-color: var(--cw-border, #e2e8f0);
	box-shadow: var(--cw-shadow-sm);
}

.cw-site-header__inner {
	display: flex;
	align-items: center;
	gap: var(--cw-space-5, 1.5rem);
	min-height: 68px;
	padding-block: var(--cw-space-1, 0.25rem);
}

.cw-site-header__brand {
	flex: 0 0 auto;
	margin-right: auto;
}

.cw-brand {
	font-size: var(--cw-text-xl, 1.375rem);
	font-weight: 800;
	letter-spacing: var(--cw-tracking-tight, -0.02em);
}

.custom-logo-link {
	display: inline-block;
}

.cw-site-header__actions {
	display: flex;
	align-items: center;
	gap: var(--cw-space-2, 0.5rem);
	flex: 0 0 auto;
}

/* Primary nav ------------------------------------------------------------- */
.cw-nav__list {
	display: flex;
	align-items: center;
	gap: var(--cw-space-2, 0.5rem);
	list-style: none;
	margin: 0;
	padding: 0;
}

.cw-nav__list a {
	position: relative;
	display: inline-flex;
	align-items: center;
	padding: 0.55rem 1.05rem;
	border-radius: var(--cw-radius-md, 12px);
	color: var(--cw-text-muted, #475569);
	font-weight: 500;
	font-size: var(--cw-text-base, 1rem);
	transition: color var(--cw-transition, 180ms ease), background var(--cw-transition, 180ms ease);
}

.cw-nav__list a:hover {
	background: var(--cw-bg-subtle, #edf0e5);
	color: var(--cw-text, #14180f);
}

/* Active page: lime text + underline bar (clear, not a pill) */
.cw-nav__list .current-menu-item > a,
.cw-nav__list .current-menu-parent > a,
.cw-nav__list .current_page_item > a {
	color: var(--cw-brand-strong, #075985);
	font-weight: 700;
	background: transparent;
}

.cw-nav__list .current-menu-item > a::after,
.cw-nav__list .current-menu-parent > a::after,
.cw-nav__list .current_page_item > a::after {
	content: "";
	position: absolute;
	left: 1.05rem;
	right: 1.05rem;
	bottom: 3px;
	height: 2px;
	border-radius: 2px;
	background: var(--cw-gradient-lime);
}

/* Icon + toggle buttons --------------------------------------------------- */
.cw-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--cw-radius-full, 999px);
	border: 1px solid var(--cw-border, #e2e8f0);
	background: var(--cw-surface, #fff);
	color: var(--cw-text, #0f172a);
	cursor: pointer;
	font-size: 1.05rem;
	transition: border-color var(--cw-transition, 180ms ease), transform var(--cw-transition, 180ms ease);
}

.cw-icon-btn:hover {
	border-color: var(--cw-brand, #0369a1);
	transform: translateY(-1px);
}

.cw-icon {
	line-height: 1;
}

.cw-icon--sun {
	display: none;
}

[data-theme="dark"] .cw-icon--sun {
	display: inline-block;
}

[data-theme="dark"] .cw-icon--moon {
	display: none;
}

.cw-nav-toggle {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	padding: 0 9px;
	border-radius: var(--cw-radius-md, 12px);
	border: 1px solid var(--cw-border, #e2e8f0);
	background: var(--cw-surface, #fff);
	cursor: pointer;
}

.cw-nav-toggle__bar {
	display: block;
	height: 2px;
	width: 100%;
	background: var(--cw-text, #0f172a);
	border-radius: 2px;
	transition: transform var(--cw-transition, 180ms ease), opacity var(--cw-transition, 180ms ease);
}

.cw-nav-toggle[aria-expanded="true"] .cw-nav-toggle__bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}
.cw-nav-toggle[aria-expanded="true"] .cw-nav-toggle__bar:nth-child(2) {
	opacity: 0;
}
.cw-nav-toggle[aria-expanded="true"] .cw-nav-toggle__bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* Mobile-first: nav is a dropdown panel, toggle + account hidden by default */
.cw-nav {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	background: var(--cw-surface, #fff);
	border-bottom: 1px solid var(--cw-border, #e2e8f0);
	box-shadow: var(--cw-shadow-md);
	padding: var(--cw-space-3, 0.75rem) var(--cw-space-4, 1rem);
	display: none;
}

.cw-nav.is-open {
	display: block;
}

.cw-nav .cw-nav__list {
	flex-direction: column;
	align-items: stretch;
	gap: 2px;
}

.cw-nav .cw-nav__list a {
	padding: 0.7rem 0.85rem;
}

.cw-account-link {
	display: none;
}

/* Account actions shown inside the open mobile menu. */
.cw-nav__account {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 10px;
	padding-top: 12px;
	border-top: 1px solid var(--cw-border, #e5e8db);
}

.cw-nav__account-btn {
	width: 100%;
	justify-content: center;
}

/* Desktop ----------------------------------------------------------------- */
@media (min-width: 880px) {
	.cw-nav__account {
		display: none;
	}

	.cw-nav {
		position: static;
		display: block;
		background: none;
		border: 0;
		box-shadow: none;
		padding: 0;
	}

	.cw-nav .cw-nav__list {
		flex-direction: row;
		align-items: center;
		gap: var(--cw-space-1, 0.25rem);
	}

	.cw-nav-toggle {
		display: none;
	}

	.cw-account-link {
		display: inline-flex;
	}
}

/* Hero -------------------------------------------------------------------- */
.cw-hero {
	position: relative;
	/* Transparent — the page-level top glow (body) shows through, so the header
	   and hero share one continuous background with no seam. */
	padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(2.5rem, 6vw, 4rem);
	background: transparent;
	text-align: center;
	overflow: hidden;
}

.cw-hero__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--cw-space-4, 1rem);
	max-width: var(--cw-container-narrow, 820px);
}

.cw-hero__eyebrow {
	background: var(--cw-gradient-brand-soft);
	color: var(--cw-brand-strong, #075985);
}

.cw-hero__title {
	margin: 0;
	font-size: clamp(2rem, 5.5vw, 3.25rem);
	line-height: 1.1;
	font-weight: 800;
	letter-spacing: var(--cw-tracking-tight, -0.02em);
}

.cw-hero__lead {
	margin: 0;
	font-size: clamp(1rem, 2.2vw, 1.2rem);
	color: var(--cw-text-muted, #475569);
	max-width: 60ch;
}

.cw-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cw-space-3, 0.75rem);
	justify-content: center;
	margin-top: var(--cw-space-2, 0.5rem);
}

/* Lists / posts ----------------------------------------------------------- */
.cw-list-wrap {
	padding: clamp(2rem, 5vw, 3.5rem) var(--cw-space-4, 1rem);
}

.cw-post-card__thumb img {
	border-radius: var(--cw-radius-md, 12px);
	margin-bottom: var(--cw-space-3, 0.75rem);
}

.cw-post-card__title {
	margin: 0 0 var(--cw-space-1, 0.25rem);
	font-size: var(--cw-text-lg, 1.125rem);
	font-weight: 700;
	letter-spacing: var(--cw-tracking-tight, -0.02em);
}

.cw-post-card__meta {
	margin: 0 0 var(--cw-space-2, 0.5rem);
	font-size: var(--cw-text-xs, 0.75rem);
	color: var(--cw-text-subtle, #94a3b8);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.cw-post-card__excerpt {
	color: var(--cw-text-muted, #475569);
	font-size: var(--cw-text-sm, 0.875rem);
}

.cw-empty {
	text-align: center;
}

.cw-empty h1,
.cw-empty h2 {
	margin-top: var(--cw-space-2, 0.5rem);
}

/* Pagination -------------------------------------------------------------- */
.cw-pagination {
	margin-top: var(--cw-space-6, 2rem);
	text-align: center;
}

.cw-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	margin: 0 3px;
	border-radius: var(--cw-radius-md, 12px);
	border: 1px solid var(--cw-border, #e2e8f0);
	background: var(--cw-surface, #fff);
	color: var(--cw-text-muted, #475569);
}

.cw-pagination .page-numbers.current {
	background: var(--cw-gradient-brand);
	color: #fff;
	border-color: transparent;
}

/* Entry content (page/single) -------------------------------------------- */
.cw-container--narrow {
	max-width: var(--cw-container-narrow, 820px);
}

.cw-entry {
	padding-block: clamp(2rem, 5vw, 3.5rem);
}

.cw-single__title {
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	letter-spacing: var(--cw-tracking-tight, -0.02em);
	line-height: 1.15;
	margin: 0 0 var(--cw-space-2, 0.5rem);
}

.cw-single__meta {
	color: var(--cw-text-subtle, #94a3b8);
	font-size: var(--cw-text-sm, 0.875rem);
}

.cw-single__thumb img {
	border-radius: var(--cw-radius-lg, 16px);
	margin-block: var(--cw-space-4, 1rem);
}

.cw-entry :where(h1, h2, h3, h4) {
	letter-spacing: var(--cw-tracking-tight, -0.02em);
	line-height: 1.25;
}

.cw-entry :where(p, ul, ol, blockquote) {
	margin-block: var(--cw-space-4, 1rem);
}

.cw-entry blockquote {
	margin-inline: 0;
	padding: var(--cw-space-2, 0.5rem) var(--cw-space-5, 1.5rem);
	border-left: 3px solid var(--cw-brand, #0369a1);
	color: var(--cw-text-muted, #475569);
	background: var(--cw-bg-subtle, #f1f5f9);
	border-radius: var(--cw-radius-sm, 8px);
}

/* Search ------------------------------------------------------------------ */
.cw-search {
	display: flex;
	gap: var(--cw-space-2, 0.5rem);
	margin-top: var(--cw-space-3, 0.75rem);
}

.cw-search__input {
	flex: 1;
	padding: 0.7rem 1rem;
	border-radius: var(--cw-radius-md, 12px);
	border: 1px solid var(--cw-border, #e2e8f0);
	background: var(--cw-surface, #fff);
	color: var(--cw-text, #0f172a);
	font: inherit;
}

.cw-search__input:focus-visible {
	outline: none;
	border-color: var(--cw-brand, #0369a1);
	box-shadow: var(--cw-ring);
}

/* Footer ------------------------------------------------------------------ */
.cw-site-footer {
	flex-shrink: 0;
	margin-top: var(--cw-space-8, 4rem);
	background:
		radial-gradient(120% 100% at 0% 0%, var(--cw-gradient-brand-soft, #e0f2fe) 0%, transparent 45%),
		var(--cw-surface-2, #f8fafc);
	border-top: 1px solid var(--cw-border, #e2e8f0);
}

.cw-site-footer__inner {
	display: grid;
	gap: var(--cw-space-6, 2rem);
	grid-template-columns: 1fr;
	padding-block: clamp(2.5rem, 5vw, 3.5rem);
}

@media (min-width: 600px) {
	.cw-site-footer__inner {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 960px) {
	.cw-site-footer__inner {
		grid-template-columns: 2.4fr 1fr 1fr 1fr;
		align-items: start;
	}
}

.cw-site-footer__brand {
	max-width: 42ch;
}

.cw-site-footer__tagline {
	color: var(--cw-text, #14180f);
	font-weight: 600;
	margin: var(--cw-space-3, 0.75rem) 0 0;
}

.cw-site-footer__about {
	color: var(--cw-text-muted, #575d4c);
	font-size: var(--cw-text-sm, 0.875rem);
	line-height: 1.6;
	margin: var(--cw-space-2, 0.5rem) 0 0;
}

.cw-site-footer__disclaimer {
	color: var(--cw-text-subtle, #969b86);
	font-size: var(--cw-text-xs, 0.75rem);
	margin: var(--cw-space-3, 0.75rem) 0 0;
}

.cw-site-footer__heading {
	margin: 0 0 var(--cw-space-3, 0.75rem);
	font-size: var(--cw-text-xs, 0.75rem);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--cw-text-subtle, #969b86);
}

.cw-footer-links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--cw-space-2, 0.5rem);
}

.cw-footer-links a {
	color: var(--cw-text-muted, #575d4c);
	font-size: var(--cw-text-sm, 0.875rem);
	text-decoration: none;
	transition: color var(--cw-transition, 180ms ease);
}

.cw-footer-links a:hover {
	color: var(--cw-brand-strong, #075985);
}

.cw-site-footer__bar {
	border-top: 1px solid var(--cw-border, #e2e8f0);
	padding-block: var(--cw-space-4, 1rem);
}

.cw-site-footer__bar-inner {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cw-space-2, 0.5rem) var(--cw-space-5, 1.5rem);
	align-items: center;
	justify-content: space-between;
}

.cw-site-footer__bar p {
	margin: 0;
	color: var(--cw-text-subtle, #969b86);
	font-size: var(--cw-text-xs, 0.75rem);
}

.cw-site-footer__legal {
	max-width: 60ch;
}

.cw-site-footer__links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.9rem;
	font-size: var(--cw-text-xs, 0.75rem);
}
.cw-site-footer__links a {
	color: var(--cw-text-muted, #475569);
	text-decoration: none;
}
.cw-site-footer__links a:hover {
	color: var(--cw-brand, #0369a1);
}
.cw-site-footer__links a + a {
	position: relative;
	padding-left: 0.9rem;
}
.cw-site-footer__links a + a::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 1px;
	height: 11px;
	transform: translateY(-50%);
	background: var(--cw-border-strong, #c2d4e2);
}

/* Legal / compliance pages (Terms, Privacy, Disclaimer) ------------------- */
.cw-legal {
	max-width: var(--cw-container-narrow, 760px);
	margin-inline: auto;
}
.cw-legal__title {
	margin: 0 0 0.35rem;
	font-size: clamp(1.9rem, 4vw, 2.6rem);
}
.cw-legal__updated {
	margin-top: 0;
	color: var(--cw-text-subtle, #64748b);
	font-size: var(--cw-text-sm, 0.875rem);
}
.cw-legal h2 {
	margin-top: var(--cw-space-6, 2rem);
	font-size: var(--cw-text-xl, 1.375rem);
}
.cw-legal :where(p, li) {
	color: var(--cw-text-muted, #475569);
	line-height: 1.7;
}
.cw-legal ul {
	padding-left: 1.25rem;
}
.cw-legal li {
	margin-block: 0.35rem;
}
.cw-legal a {
	color: var(--cw-brand, #0369a1);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.cw-legal a:hover {
	color: var(--cw-brand-strong, #075985);
}
