/*
Theme Name: NB Consulting
Theme URI: https://neilbertelsen.com/
Author: Neil Bertelsen Consulting
Description: A calm, warm and simple theme made for Neil Bertelsen Consulting. Short full-width header images, a widget area on the Home page only, an optional widget area for the "My Background" page template, and no cookies or third-party requests.
Version: 1.0.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nb-consulting
*/

/* ---------- Design tokens (colours, sizes) ---------- */
:root {
	--nbc-ground: #FBF8F3;
	--nbc-ink: #221E1A;
	--nbc-muted: #5C534A;
	--nbc-line: #E4DACB;
	--nbc-card: #F4EDE2;
	--nbc-accent: #8C4A2B;
	--nbc-accent-dark: color-mix(in srgb, var(--nbc-accent) 70%, #000);
	--nbc-footer-bg: #EDE3D3;
	--nbc-header-h: 240px;
	--nbc-fade: 0.42;
	--nbc-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
	--nbc-sans: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
	--nbc-container: 1120px;
	--nbc-text: 760px;
}

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

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

body {
	margin: 0;
	background: var(--nbc-ground);
	color: var(--nbc-ink);
	font-family: var(--nbc-sans);
	font-size: 18px;
	line-height: 1.65;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

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

a { color: var(--nbc-accent); text-underline-offset: 0.15em; }
a:hover, a:focus { color: var(--nbc-accent-dark); }
:focus-visible { outline: 2px solid var(--nbc-accent); outline-offset: 2px; }

h1, h2, h3, h4 {
	font-family: var(--nbc-serif);
	font-weight: 600;
	line-height: 1.25;
	color: var(--nbc-ink);
}

.container {
	width: 100%;
	max-width: var(--nbc-container);
	margin: 0 auto;
	padding: 0 32px;
}

.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;
}
.skip-link:focus {
	clip: auto; clip-path: none; height: auto; width: auto; margin: 0;
	left: 12px; top: 12px; z-index: 1000; padding: 12px 18px;
	background: var(--nbc-ground); color: var(--nbc-ink); font-weight: 600;
}

/* ---------- Header with image ---------- */
.site-header {
	position: relative;
	height: var(--nbc-header-h);
	background-color: #CDB89A;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	display: flex;
	align-items: center;
	overflow: hidden;
}
/* The soft light veil that fades the image */
.site-header::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(251, 248, 243, var(--nbc-fade));
}
.site-header.has-no-image { background-color: var(--nbc-card); }
.site-header.has-no-image::before { display: none; }

.site-header.pos-top { background-position: center top; }
.site-header.pos-center { background-position: center; }
.site-header.pos-bottom { background-position: center bottom; }
.site-header.is-stretched { background-size: 100% max(100%, calc(100vw / 3.6)); }
@media (max-width: 860px) {
	.site-header.is-stretched { background-size: cover; }
}

.site-header .container { position: relative; z-index: 1; }

.site-branding {
	display: inline-flex;
	align-items: center;
	gap: 18px;
	background: rgba(251, 248, 243, 0.88);
	padding: 16px 28px;
	border-radius: 4px;
	max-width: 100%;
}
.site-branding .custom-logo-link,
.site-branding .default-logo-link { display: block; flex-shrink: 0; line-height: 0; }
.site-branding .custom-logo,
.site-branding .default-logo { width: 64px; height: 64px; object-fit: contain; }

.site-title {
	margin: 0;
	font-family: var(--nbc-serif);
	font-weight: 600;
	font-size: 38px;
	line-height: 1.15;
}
.site-title a { color: var(--nbc-ink); text-decoration: none; }
.site-title a:hover { color: var(--nbc-ink); }

/* ---------- Main menu (under the header image) ---------- */
.main-nav {
	border-bottom: 1px solid var(--nbc-line);
	background: var(--nbc-ground);
}
.main-nav .menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0 32px;
	font-size: 17px;
}
.main-nav .menu a {
	display: block;
	padding: 14px 0;
	color: var(--nbc-ink);
	text-decoration: none;
	border-bottom: 2px solid transparent;
}
.main-nav .menu a:hover { border-bottom-color: var(--nbc-line); }
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a {
	font-weight: 600;
	border-bottom-color: var(--nbc-accent);
}

/* ---------- Page layout ---------- */
.site-content { flex: 1; }

.page-main {
	padding-top: 56px;
	padding-bottom: 80px;
}
.page-main.has-sidebar {
	display: flex;
	flex-wrap: wrap;
	gap: 48px 64px;
	align-items: flex-start;
}
.page-main.has-sidebar > .entry { flex: 999 1 520px; min-width: 0; }

/* Home page: widget area on the LEFT */
.sidebar-home {
	flex: 1 1 280px;
	max-width: 320px;
	min-width: 260px;
}
.front-page .entry { max-width: 700px; }

/* My Background page: optional widget area on the RIGHT, kept slim */
.sidebar-background {
	flex: 1 1 220px;
	max-width: 260px;
	min-width: 220px;
}

@media (max-width: 860px) {
	.sidebar-home, .sidebar-background { max-width: none; flex-basis: 100%; }
	/* On phones the Home sidebar follows the main text */
	.front-page .sidebar-home { order: 2; }
}

/* ---------- Page content ---------- */
.entry-title {
	margin: 0 0 28px;
	font-size: 42px;
}

.entry-content > * { max-width: var(--nbc-text); }
.entry-content > .wp-block-table,
.entry-content > .wp-block-columns,
.entry-content > .alignwide,
.entry-content > .alignfull,
.entry-content > figure.wp-block-image.alignwide { max-width: none; }

.entry-content h2 { font-size: 24px; color: var(--nbc-accent); margin: 1.6em 0 0.4em; }
.entry-content h3 { font-size: 20px; margin: 1.4em 0 0.4em; }
.entry-content > h2:first-child,
.entry-content > h3:first-child { margin-top: 0; }
.entry-content p { margin: 0 0 1.1em; }
.entry-content ul, .entry-content ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.entry-content li { margin-bottom: 0.45em; }
.entry-content blockquote {
	margin: 1.5em 0;
	padding: 0 0 0 1.2em;
	font-family: var(--nbc-serif);
	font-size: 22px;
	line-height: 1.5;
	border-left: 2px solid var(--nbc-line);
}
.entry-content figure { margin: 0 0 1.4em; }
.entry-content img { border-radius: 4px; }
.entry-content .has-large-font-size,
.entry-content .is-style-lead { font-size: 21px; line-height: 1.6; }

/* Two-column story (Columns block) */
.entry-content .wp-block-columns {
	gap: 32px 48px;
	margin: 0 0 1.6em;
	padding: 36px 0;
	border-top: 1px solid var(--nbc-line);
	border-bottom: 1px solid var(--nbc-line);
}
.entry-content .wp-block-column h2:first-child,
.entry-content .wp-block-column h3:first-child { margin-top: 0; }
.entry-content .wp-block-column h2 { font-size: 22px; }

/* Articles table (Table block) */
.entry-content .wp-block-table {
	overflow-x: auto;
	border: 1px solid var(--nbc-line);
	border-radius: 6px;
	margin: 0 0 1.6em;
}
.entry-content .wp-block-table table,
.entry-content .wp-block-table table.has-fixed-layout {
	table-layout: auto;
	width: 100%;
	min-width: 860px;
	border-collapse: collapse;
	font-size: 16px;
	line-height: 1.5;
}
.entry-content .wp-block-table th,
.entry-content .wp-block-table td {
	padding: 14px 16px;
	text-align: left;
	vertical-align: top;
	border: 0;
	border-top: 1px solid var(--nbc-line);
}
.entry-content .wp-block-table thead th,
.entry-content .wp-block-table thead td {
	background: var(--nbc-card);
	font-weight: 600;
	border-top: 0;
	border-bottom: 0;
}
.entry-content .wp-block-table thead,
.entry-content .wp-block-table tfoot { border: 0; }
.entry-content .wp-block-table tbody tr:first-child td { border-top: 0; }
.entry-content .wp-block-table th:nth-child(2) { width: 38%; }
.entry-content .wp-block-table th:nth-child(3) { width: 26%; }
.entry-content .wp-block-table td:nth-child(2) { font-weight: 600; }
.entry-content .wp-block-table td:nth-child(1),
.entry-content .wp-block-table td:nth-child(3) { color: var(--nbc-muted); }
.entry-content .wp-block-table td:nth-child(4) { white-space: nowrap; }
.entry-content .wp-block-table td a { font-weight: 600; }
.entry-content .wp-block-table figcaption { padding: 10px 16px; font-size: 14px; color: var(--nbc-muted); }

/* ---------- Widgets (sidebars) ---------- */
.widget-area { font-size: 16px; line-height: 1.55; display: flex; flex-direction: column; gap: 28px; }
.widget {
	background: var(--nbc-card);
	border-radius: 6px;
	padding: 22px 24px;
}
.widget-title,
.widget h2,
.widget .wp-block-heading {
	margin: 0 0 12px;
	font-family: var(--nbc-serif);
	font-weight: 600;
	font-size: 19px;
	color: var(--nbc-accent);
}
.widget p { margin: 0 0 0.8em; }
.widget p:last-child { margin-bottom: 0; }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 10px 0; border-top: 1px solid var(--nbc-line); }
.widget li:last-child { padding-bottom: 0; }
.widget strong { color: var(--nbc-ink); }
.widget .wp-block-separator { border: 0; border-top: 1px solid var(--nbc-line); margin: 12px 0; }
.widget iframe { max-width: 100%; }

/* ---------- Footer ---------- */
.site-footer {
	background: var(--nbc-footer-bg);
	color: var(--nbc-ink);
}
.footer-inner {
	padding-top: 40px;
	padding-bottom: 40px;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 32px;
}
.footer-nav .menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 16px;
}
.footer-nav a { color: var(--nbc-ink); }
.footer-nav a:hover { color: var(--nbc-accent-dark); }
.footer-brand { text-align: right; margin-left: auto; }
.footer-title {
	margin: 0;
	font-family: var(--nbc-serif);
	font-weight: 600;
	font-size: 22px;
}
.footer-copy { margin: 4px 0 0; font-size: 14px; color: #4A4138; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
	.container { padding: 0 18px; }
	body { font-size: 17px; }
	.site-title { font-size: 26px; }
	.site-branding { padding: 12px 16px; gap: 12px; }
	.site-branding .custom-logo,
	.site-branding .default-logo { width: 44px; height: 44px; }
	.main-nav .menu { gap: 0 20px; font-size: 16px; }
	.entry-title { font-size: 32px; }
	.page-main { padding-top: 36px; padding-bottom: 56px; }
	.footer-brand { text-align: left; margin-left: 0; }
}

/* ---------- WordPress core classes ---------- */
.alignleft { float: left; margin: 0.3em 1.5em 1em 0; }
.alignright { float: right; margin: 0.3em 0 1em 1.5em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption-text, figcaption { font-size: 14px; color: var(--nbc-muted); margin-top: 6px; }
