/* WF Blog Layout — helper styles on top of the Blocksy theme.
   Colours come from the Blocksy palette (--theme-palette-color-1..8),
   so changing the palette in the Customizer carries through. */

:root {
	--wfbl-line: var(--theme-palette-color-5);
	--wfbl-surface: var(--theme-palette-color-8);
	--wfbl-page: var(--theme-palette-color-7);
	--wfbl-text: var(--theme-palette-color-3);
	--wfbl-accent: var(--theme-palette-color-1);
	--wfbl-on-accent: #ffffff;

	/* Header */
	--wfbl-header-bg: var(--theme-palette-color-1);
	--wfbl-header-fg: #ffffff;
	--wfbl-header-field-bg: #ffffff;
	--wfbl-header-field-fg: #1f2a3a;
	--wfbl-header-field-placeholder: #6b7a8c;
	--wfbl-header-btn-bg: rgba(255, 255, 255, 0.16);
	--wfbl-header-btn-bg-hover: rgba(255, 255, 255, 0.3);
	--wfbl-header-btn-border: rgba(255, 255, 255, 0.45);

	/* Tag chips */
	--wfbl-chip-bg: rgba(40, 114, 250, 0.11);
	--wfbl-chip-bg-hover: rgba(40, 114, 250, 0.2);
	--wfbl-chip-fg: #1b55c9;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
	:root {
		--wfbl-chip-bg: color-mix(in srgb, var(--wfbl-accent) 11%, transparent);
		--wfbl-chip-bg-hover: color-mix(in srgb, var(--wfbl-accent) 20%, transparent);
		--wfbl-chip-fg: color-mix(in srgb, var(--wfbl-accent) 72%, #0a1b3d);
	}
}

/* ---------- Dark mode: swap the palette only ---------- */
html[data-wfbl-mode="dark"] {
	color-scheme: dark;
	--theme-palette-color-1: #5b9dff;
	--theme-palette-color-2: #86b6ff;
	--theme-palette-color-3: #c5cfdb;
	--theme-palette-color-4: #f1f5f9;
	--theme-palette-color-5: #2c3644;
	--theme-palette-color-6: #1c242e;
	--theme-palette-color-7: #11161c;
	--theme-palette-color-8: #171d25;
	--wfbl-on-accent: #0c1420;

	--wfbl-header-bg: #16233c;
	--wfbl-header-field-bg: rgba(255, 255, 255, 0.08);
	--wfbl-header-field-fg: #e8eef6;
	--wfbl-header-field-placeholder: rgba(232, 238, 246, 0.55);
	--wfbl-header-btn-bg: rgba(255, 255, 255, 0.08);
	--wfbl-header-btn-bg-hover: rgba(255, 255, 255, 0.18);
	--wfbl-header-btn-border: rgba(255, 255, 255, 0.22);

	--wfbl-chip-bg: rgba(91, 157, 255, 0.16);
	--wfbl-chip-bg-hover: rgba(91, 157, 255, 0.28);
	--wfbl-chip-fg: #a9cbff;
}

/* ---------- Header: coloured bar ---------- */
#header.ct-header [data-row*="middle"] {
	background: var(--wfbl-header-bg);
	box-shadow: none;
}

#header.ct-header .site-title,
#header.ct-header .site-title a {
	color: var(--wfbl-header-fg);
	--theme-link-initial-color: var(--wfbl-header-fg);
	--theme-link-hover-color: var(--wfbl-header-fg);
}

#header.ct-header .site-title a:hover {
	opacity: 0.86;
}

/* ---------- Header: search box + buttons ---------- */
.wfbl-tools {
	display: flex;
	align-items: center;
	gap: 10px;
}

.wfbl-tools .wfbl-search {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
}

.wfbl-tools .wfbl-search input[type="search"] {
	width: clamp(110px, 38vw, 460px);
	height: 40px;
	margin: 0;
	padding: 0 18px;
	border: 1.5px solid transparent;
	border-radius: 999px;
	background: var(--wfbl-header-field-bg);
	color: var(--wfbl-header-field-fg);
	font-size: 15px;
	box-shadow: none;
}

.wfbl-tools .wfbl-search input[type="search"]::placeholder {
	color: var(--wfbl-header-field-placeholder);
	opacity: 1;
}

.wfbl-tools .wfbl-search input[type="search"]:focus {
	border-color: transparent;
	outline: 2px solid rgba(255, 255, 255, 0.75);
	outline-offset: 2px;
}

.wfbl-tools .wfbl-iconbtn {
	flex: none;
	display: inline-grid;
	place-items: center;
	width: 40px;
	height: 40px;
	min-height: 0;
	padding: 0;
	border: 1.5px solid var(--wfbl-header-btn-border);
	border-radius: 50%;
	background: var(--wfbl-header-btn-bg);
	color: var(--wfbl-header-fg);
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s;
}

.wfbl-tools .wfbl-iconbtn:hover,
.wfbl-tools .wfbl-iconbtn:focus-visible {
	background: var(--wfbl-header-btn-bg-hover);
	border-color: var(--wfbl-header-fg);
	color: var(--wfbl-header-fg);
}

.wfbl-mode-toggle .wfbl-icon-sun { display: none; }
html[data-wfbl-mode="dark"] .wfbl-mode-toggle .wfbl-icon-sun { display: block; }
html[data-wfbl-mode="dark"] .wfbl-mode-toggle .wfbl-icon-moon { display: none; }

@media (max-width: 689.98px) {
	.wfbl-tools { gap: 6px; }
	.wfbl-tools .wfbl-search { gap: 6px; }
	.wfbl-tools .wfbl-search input[type="search"] {
		width: clamp(90px, 34vw, 220px);
		height: 36px;
		padding: 0 12px;
		font-size: 14px;
	}
	.wfbl-tools .wfbl-iconbtn { width: 36px; height: 36px; }
}

/* ---------- Tag bar: sticks to the top while the header scrolls away ---------- */
.wfbl-tagbar-sentinel {
	height: 1px;
	margin-bottom: -1px;
}

.wfbl-tagbar-wrap {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 40;
	margin-top: 14px;
	padding: 10px 0;
	background: var(--wfbl-page);
	transition: box-shadow 0.2s;
}

.wfbl-tagbar-wrap.is-stuck {
	box-shadow: 0 1px 0 var(--wfbl-line), 0 12px 18px -16px rgba(15, 23, 42, 0.45);
}

.wfbl-tagbar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 8px;
	border: 1.5px solid var(--wfbl-line);
	border-radius: 999px;
	background: var(--wfbl-surface);
}

.wfbl-tagbar__scroll {
	position: relative;
	flex: 1;
	min-width: 0;
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	padding: 2px;
}

.wfbl-tagbar__scroll::-webkit-scrollbar { display: none; }

.wfbl-tagbar .wfbl-tag {
	flex: none;
	padding: 6px 16px;
	border-radius: 999px;
	background: var(--wfbl-chip-bg);
	color: var(--wfbl-chip-fg);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
	text-decoration: none;
	transition: background-color 0.15s, color 0.15s;
}

.wfbl-tagbar .wfbl-tag:hover {
	background: var(--wfbl-chip-bg-hover);
	color: var(--wfbl-chip-fg);
}

.wfbl-tagbar .wfbl-tag.is-active {
	background: var(--wfbl-accent);
	color: var(--wfbl-on-accent);
}

.wfbl-tagbar .wfbl-tagbar__btn {
	flex: none;
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	min-height: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wfbl-chip-bg);
	color: var(--wfbl-chip-fg);
	cursor: pointer;
}

.wfbl-tagbar .wfbl-tagbar__btn:hover {
	background: var(--wfbl-chip-bg-hover);
	color: var(--wfbl-chip-fg);
}

.wfbl-tagbar .wfbl-tagbar__btn[hidden] { display: none; }

/* On touch screens people swipe, so the arrow buttons are hidden. */
@media (hover: none) and (pointer: coarse) {
	.wfbl-tagbar .wfbl-tagbar__btn { display: none; }
}

/* ---------- Cards: background image + title band + date/tags row ---------- */
.entries[data-cards="cover"] .entry-card {
	padding: 0;
	overflow: hidden;
	justify-content: flex-end;
	border: 1.5px solid var(--wfbl-line);
	border-radius: 18px;
	/* Fallback background for posts without a featured image */
	background: linear-gradient(135deg, var(--theme-palette-color-6), var(--theme-palette-color-5));
}

.entries[data-cards="cover"] .entry-card > .ct-media-container::after {
	background: none;
}

.entries[data-cards="cover"] .entry-card .entry-title {
	margin: 0;
	padding: 9px 16px;
	background: var(--wfbl-accent);
	color: var(--wfbl-on-accent);
	font-size: 17px;
	line-height: 1.4;
	/* One line only; longer titles end with an ellipsis */
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.entries[data-cards="cover"] .entry-card .entry-title a,
.entries[data-cards="cover"] .entry-card .entry-title a:hover {
	color: inherit;
}

.entries[data-cards="cover"] .entry-card .entry-meta {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 8px 16px;
	background: var(--wfbl-surface);
	color: var(--wfbl-text);
	--theme-link-initial-color: var(--wfbl-text);
	--theme-link-hover-color: var(--wfbl-accent);
	font-size: 12.5px;
	font-weight: 500;
	text-transform: none;
	white-space: nowrap;
	overflow: hidden;
}

.entries[data-cards="cover"] .entry-card .entry-meta li {
	flex: none;
	margin: 0;
}

.entries[data-cards="cover"] .entry-card .entry-meta li::after {
	content: none;
}

/* Many tags: cut off with an ellipsis at the end of the row */
.entries[data-cards="cover"] .entry-card .entry-meta li.meta-categories {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

.entries[data-cards="cover"] .entry-card .entry-meta .meta-categories a::before {
	content: "#";
}

/* ---------- Load more button ---------- */
.ct-load-more {
	border-radius: 999px;
	padding-inline: 32px;
}

/* ---------- In-place tag switching ---------- */
#main .entries,
#main .ct-pagination {
	transition: opacity 0.15s;
}

#main.wfbl-loading .entries,
#main.wfbl-loading .ct-pagination {
	opacity: 0.45;
	pointer-events: none;
}

/* Always reserve room for the vertical scrollbar, so the layout does not
   shift sideways between long pages (All) and short ones (a single tag). */
html {
	scrollbar-gutter: stable;
}

/* ---------- 404 page: heading only ---------- */
body.error404 .ct-no-results .page-description,
body.error404 .ct-no-results .entry-content {
	display: none;
}
