/* =========================================================
   NicheLite SEO — main stylesheet
   Lightweight, mobile-first, CSS variables, no external deps.
   ========================================================= */

:root {
	--nl-accent: #2563eb;
	--nl-header-bg: #ffffff;
	--nl-body-bg: #ffffff;
	--nl-text: #111827;
	--nl-muted: #6b7280;
	--nl-border: #e5e7eb;
	--nl-soft-bg: #f9fafb;
	--nl-link: #2563eb;
	--nl-radius: 8px;
	--nl-container: 1120px;
	--nl-content: 760px;
	--nl-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	--nl-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

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

body {
	margin: 0;
	font-family: var(--nl-font);
	font-size: 16px;
	line-height: 1.65;
	color: var(--nl-text);
	background: var(--nl-body-bg);
	-webkit-font-smoothing: antialiased;
}

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

a { color: var(--nl-link); text-decoration: underline; text-underline-offset: 2px; }
a:hover, a:focus { text-decoration: none; }

button { font: inherit; cursor: pointer; }

:focus-visible { outline: 2px solid var(--nl-accent); outline-offset: 2px; border-radius: 4px; }

.screen-reader-text {
	position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px;
	overflow: hidden; word-wrap: normal !important;
}

.skip-link {
	position: absolute; left: -9999px; top: 0; background: #000; color: #fff;
	padding: 0.5rem 0.75rem; z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.container { max-width: var(--nl-container); margin: 0 auto; padding: 0 1rem; }

/* Headings */
h1, h2, h3, h4, h5, h6 { line-height: 1.25; margin: 1.5em 0 0.5em; font-weight: 700; color: var(--nl-text); }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.7rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.5rem; }
hr { border: 0; border-top: 1px solid var(--nl-border); margin: 2rem 0; }

blockquote {
	border-left: 4px solid var(--nl-accent);
	margin: 1.5rem 0; padding: 0.5rem 1rem; background: var(--nl-soft-bg);
	border-radius: var(--nl-radius);
}

code, pre { font-family: var(--nl-mono); font-size: 0.95em; }
pre {
	background: var(--nl-soft-bg);
	border: 1px solid var(--nl-border);
	border-radius: var(--nl-radius);
	padding: 1rem;
	overflow: auto;
}
code { background: var(--nl-soft-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre code { background: transparent; padding: 0; }

table { border-collapse: collapse; width: 100%; margin: 1.5rem 0; }
th, td { border: 1px solid var(--nl-border); padding: 0.5rem 0.75rem; text-align: left; }
thead th { background: var(--nl-soft-bg); }

/* Header */
.site-header {
	background: var(--nl-header-bg);
	border-bottom: 1px solid var(--nl-border);
}
.has-sticky-header .site-header { position: sticky; top: 0; z-index: 50; }

.site-header__inner {
	display: flex; align-items: center; justify-content: space-between;
	gap: 1rem; min-height: 64px; padding-top: 0.5rem; padding-bottom: 0.5rem;
}
.site-branding { display: flex; align-items: center; gap: 0.75rem; }
.site-title { margin: 0; font-size: 1.25rem; font-weight: 700; }
.site-title a { color: var(--nl-text); text-decoration: none; }
.custom-logo-link img { max-height: 48px; width: auto; }

/* Navigation */
.site-nav { display: flex; align-items: center; }
.nav-toggle {
	display: inline-flex; align-items: center; justify-content: center;
	width: 40px; height: 40px;
	border: 1px solid var(--nl-border); background: #fff; border-radius: var(--nl-radius);
}
.nav-toggle__icon, .nav-toggle__icon::before, .nav-toggle__icon::after {
	display: block; width: 18px; height: 2px; background: currentColor; position: relative;
}
.nav-toggle__icon::before, .nav-toggle__icon::after {
	content: ""; position: absolute; left: 0;
}
.nav-toggle__icon::before { top: -6px; }
.nav-toggle__icon::after { top: 6px; }

.menu, .primary-menu, .footer-menu {
	list-style: none; margin: 0; padding: 0;
	display: flex; flex-direction: column; gap: 0.25rem;
}
.primary-menu { display: none; }
.primary-menu.is-open {
	display: flex; position: absolute; left: 0; right: 0; top: 100%;
	background: var(--nl-header-bg); border-top: 1px solid var(--nl-border);
	padding: 0.5rem 1rem; gap: 0;
}
.primary-menu a {
	display: block; padding: 0.6rem 0; color: var(--nl-text); text-decoration: none;
	border-bottom: 1px solid var(--nl-border);
}
.primary-menu li:last-child a { border-bottom: 0; }
.primary-menu .sub-menu { list-style: none; margin: 0; padding-left: 1rem; }

@media (min-width: 768px) {
	.site-header__inner { position: relative; }
	.nav-toggle { display: none; }
	.primary-menu { display: flex !important; position: static; flex-direction: row; gap: 1.25rem; border: 0; padding: 0; background: transparent; }
	.primary-menu a { border: 0; padding: 0.25rem 0; }
	.primary-menu .sub-menu {
		position: absolute; background: #fff; border: 1px solid var(--nl-border);
		border-radius: var(--nl-radius); padding: 0.5rem; min-width: 200px;
		box-shadow: 0 4px 12px rgba(0,0,0,0.05);
		display: none;
	}
	.primary-menu li:hover > .sub-menu,
	.primary-menu li:focus-within > .sub-menu { display: block; }
}

/* Layout */
.site-main { padding: 1.5rem 0 2.5rem; min-height: 60vh; }
.layout { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: start; }
@media (min-width: 960px) {
	.has-sidebar .layout {
		grid-template-columns: minmax(0, 1fr) 300px;
	}
}
.layout__content { min-width: 0; }
.entry, .entry--single, .entry--page, .page-header, .no-results, .error-404, .related-posts, .comments-area, .post-nav {
	max-width: var(--nl-content); margin-left: auto; margin-right: auto;
}
.has-sidebar .entry, .has-sidebar .entry--single, .has-sidebar .entry--page,
.has-sidebar .page-header, .has-sidebar .no-results, .has-sidebar .error-404,
.has-sidebar .related-posts, .has-sidebar .comments-area, .has-sidebar .post-nav {
	max-width: none;
}

/* Breadcrumbs */
.breadcrumbs { font-size: 0.875rem; color: var(--nl-muted); margin-bottom: 1rem; }
.breadcrumbs__list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.breadcrumbs__item { display: inline-flex; align-items: center; gap: 0.25rem; }
.breadcrumbs__item a { color: var(--nl-muted); }
.breadcrumbs__sep { color: var(--nl-muted); }

/* Page header */
.page-header { margin-bottom: 1.5rem; }
.page-title { margin: 0 0 0.5rem; }

/* Entry */
.entry-header { margin-bottom: 1rem; }
.entry-title { margin: 0.25rem 0; }
.post-meta {
	color: var(--nl-muted); font-size: 0.9rem;
	display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center;
}
.post-meta__cat {
	display: inline-block; padding: 0.1rem 0.5rem;
	background: var(--nl-soft-bg); border-radius: 999px;
	color: var(--nl-accent); text-decoration: none; font-weight: 600;
}
.entry-featured { margin: 1rem 0 1.25rem; }
.entry-featured img { border-radius: var(--nl-radius); width: 100%; }

.entry-content > * + * { margin-top: 1rem; }
.entry-content h2, .entry-content h3, .entry-content h4 { scroll-margin-top: 80px; }

.entry-footer { margin-top: 1.5rem; font-size: 0.95rem; color: var(--nl-muted); }
.tag-links a {
	display: inline-block; padding: 0.15rem 0.5rem; margin: 0.1rem;
	background: var(--nl-soft-bg); border-radius: 999px; text-decoration: none; color: var(--nl-text);
	font-size: 0.85rem;
}

/* Cards / post grid */
.post-grid {
	display: grid; gap: 1.25rem; grid-template-columns: 1fr;
}
@media (min-width: 640px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .has-sidebar .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .no-sidebar .post-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
	background: #fff;
	border: 1px solid var(--nl-border);
	border-radius: var(--nl-radius);
	overflow: hidden;
	display: flex; flex-direction: column;
}
.card__media { aspect-ratio: 16 / 9; background: var(--nl-soft-bg); display: block; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.card__cat {
	align-self: flex-start; font-size: 0.75rem; font-weight: 600;
	text-transform: uppercase; letter-spacing: 0.04em;
	color: var(--nl-accent); text-decoration: none;
}
.card__title { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.card__title a { color: var(--nl-text); text-decoration: none; }
.card__title a:hover { color: var(--nl-accent); }
.card__meta { font-size: 0.8rem; color: var(--nl-muted); }
.card__excerpt { margin: 0; font-size: 0.92rem; color: var(--nl-muted); }

/* Sidebar */
.site-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.widget { background: #fff; border: 1px solid var(--nl-border); border-radius: var(--nl-radius); padding: 1rem 1.1rem; }
.widget-title { margin: 0 0 0.6rem; font-size: 1.05rem; }
.popular-list { list-style: none; padding: 0; margin: 0; }
.popular-list__item + .popular-list__item { border-top: 1px solid var(--nl-border); }
.popular-list__link {
	display: block; padding: 0.6rem 0; text-decoration: none; color: var(--nl-text); font-weight: 500;
}
.popular-list__link:hover { color: var(--nl-accent); }

/* Table of contents */
.toc {
	background: var(--nl-soft-bg);
	border: 1px solid var(--nl-border);
	border-radius: var(--nl-radius);
	padding: 0.75rem 1rem;
	margin: 1.5rem 0;
}
.toc__toggle {
	display: flex; align-items: center; justify-content: space-between;
	width: 100%; background: transparent; border: 0; padding: 0;
	font-weight: 700; font-size: 1rem; color: var(--nl-text);
}
.toc__chevron {
	width: 10px; height: 10px;
	border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
	transform: rotate(45deg); transition: transform 0.15s ease-out;
}
.toc[aria-expanded="false"] .toc__chevron,
.toc__toggle[aria-expanded="false"] .toc__chevron { transform: rotate(-45deg); }
.toc__list { margin: 0.75rem 0 0; padding-left: 1.25rem; }
.toc__item { margin: 0.25rem 0; }
.toc__item--sub { margin-left: 1rem; font-size: 0.95rem; }
.toc[data-collapsed="true"] .toc__list { display: none; }

/* Ad slots — reserve space to prevent CLS */
.ad-slot {
	margin: 1.5rem 0;
	text-align: center;
	background: var(--nl-soft-bg);
	border: 1px dashed var(--nl-border);
	border-radius: var(--nl-radius);
	padding: 0.6rem;
	min-height: 280px;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	overflow: hidden;
}
.ad-slot__label {
	display: block; font-size: 0.7rem; letter-spacing: 0.08em;
	text-transform: uppercase; color: var(--nl-muted); margin-bottom: 0.5rem;
}
.ad-slot--header { min-height: 100px; }
.ad-slot--in-article { min-height: 260px; }
.ad-slot--sidebar { min-height: 250px; }
.ad-slot--footer { min-height: 100px; margin: 0; border-radius: 0; }

@media (max-width: 480px) {
	.ad-slot { min-height: 250px; }
	.ad-slot--header { min-height: 100px; }
}

/* Direct Link CTA */
.direct-link-cta { text-align: center; margin: 1.5rem 0; }
.button {
	display: inline-block; padding: 0.7rem 1.2rem;
	background: var(--nl-accent); color: #fff; text-decoration: none;
	border-radius: var(--nl-radius); font-weight: 600;
	border: 0;
}
.button:hover, .button:focus { filter: brightness(1.05); }
.button--cta { padding: 0.85rem 1.5rem; font-size: 1.05rem; }

/* Post nav */
.post-nav {
	display: grid; gap: 0.75rem; grid-template-columns: 1fr;
	margin: 2rem 0;
}
@media (min-width: 640px) { .post-nav { grid-template-columns: 1fr 1fr; } }
.post-nav__link {
	display: flex; flex-direction: column; gap: 0.25rem;
	padding: 0.75rem 1rem; border: 1px solid var(--nl-border);
	border-radius: var(--nl-radius); text-decoration: none; color: var(--nl-text);
	background: #fff;
}
.post-nav__link--next { text-align: right; }
.post-nav__label { font-size: 0.8rem; color: var(--nl-muted); }
.post-nav__title { font-weight: 600; }

/* Related */
.related-posts { margin: 2.5rem 0 1rem; }
.related-posts__title { margin: 0 0 1rem; }

/* Pagination */
.pagination { margin: 2rem 0; }
.pagination__list { display: flex; flex-wrap: wrap; gap: 0.3rem; list-style: none; padding: 0; margin: 0; justify-content: center; }
.pagination__item a, .pagination__item span {
	display: inline-block; padding: 0.5rem 0.8rem;
	border: 1px solid var(--nl-border); border-radius: var(--nl-radius);
	text-decoration: none; color: var(--nl-text); background: #fff;
}
.pagination__item .current { background: var(--nl-accent); color: #fff; border-color: var(--nl-accent); }

/* Footer */
.site-footer {
	background: var(--nl-soft-bg); border-top: 1px solid var(--nl-border);
	margin-top: 2.5rem; padding: 2rem 0 1.25rem;
	color: var(--nl-muted);
}
.site-footer__widgets {
	display: grid; gap: 1.5rem; grid-template-columns: 1fr;
	margin-bottom: 1.5rem;
}
@media (min-width: 760px) { .site-footer__widgets { grid-template-columns: repeat(3, 1fr); } }
.site-footer__bottom {
	display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
	border-top: 1px solid var(--nl-border); padding-top: 1rem;
}
.footer-menu { flex-direction: row; gap: 1rem; flex-wrap: wrap; }
.footer-menu a { color: var(--nl-muted); text-decoration: none; }
.footer-menu a:hover { color: var(--nl-accent); }
.site-credit { margin: 0; font-size: 0.9rem; }

/* Search form
   WP with html5 support wraps the input in a <label>, so the label is the
   flex item — not the input. We size the label and let the input fill it.
   min-width:0 lets the input shrink below its default intrinsic size,
   which is what was causing overflow inside narrow widget containers. */
.search-form {
	display: flex; flex-wrap: wrap; gap: 0.5rem;
	max-width: 520px; width: 100%;
}
.search-form > label {
	flex: 1 1 0; min-width: 0; display: block; margin: 0;
}
.search-form .search-field {
	width: 100%; min-width: 0;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--nl-border); border-radius: var(--nl-radius);
	font: inherit;
}
.search-form .search-submit {
	flex: 0 0 auto;
	padding: 0.6rem 1rem;
	background: var(--nl-accent); color: #fff; border: 0; border-radius: var(--nl-radius);
	cursor: pointer;
}
.widget .search-form { max-width: 100%; }

/* Comments */
.comments-area { margin: 2.5rem 0; }
.comment-list { list-style: none; padding: 0; }
.comment-body {
	background: #fff; border: 1px solid var(--nl-border); border-radius: var(--nl-radius);
	padding: 1rem; margin-bottom: 1rem;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%; max-width: 520px;
	padding: 0.55rem 0.7rem; border: 1px solid var(--nl-border); border-radius: var(--nl-radius);
	font: inherit;
}
.comment-form textarea { max-width: 100%; min-height: 120px; }

/* Print */
@media print {
	.site-header, .site-footer, .site-sidebar, .ad-slot, .post-nav, .related-posts, .toc, .breadcrumbs, .nav-toggle, .site-nav { display: none !important; }
	.layout { display: block; }
	body { font-size: 12pt; color: #000; background: #fff; }
	a { color: #000; text-decoration: underline; }
}

/* Block alignment */
.alignwide { max-width: min(100%, calc(var(--nl-content) + 200px)); margin-left: auto; margin-right: auto; }
.alignfull { width: 100%; max-width: none; }
.aligncenter { margin-left: auto; margin-right: auto; display: block; }
.alignleft { float: left; margin: 0 1rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1rem; }

/* Gutenberg embeds */
.wp-block-embed iframe { max-width: 100%; }
