/*
Theme Name: SI_Blogs
Theme URI: https://searchintelligence.services/signals
Author: Search Intelligence
Author URI: https://searchintelligence.services
Description: A dedicated WordPress block (FSE) blog theme for Search Intelligence's "Signals" publication — dated intelligence briefings from the search environment. Token-driven design system: Inter typography, cool-grey neutrals, signal-blue accent.
Version: 2.0.0
Requires at least: 6.5
Tested up to: 6.7
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: si-blogs
Tags: blog, one-column, block-patterns, custom-colors, custom-logo, editor-style, full-site-editing, threaded-comments, translation-ready, wide-blocks
*/

/* Design tokens live in theme.json; this file carries resets + components. */

html {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

/* Eyebrow label */
.si-eyebrow {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent-secondary);
}
.si-eyebrow.is-on-dark { color: var(--wp--preset--color--accent-light); }

/* Site logo */
.wp-block-site-logo img { height: 34px; width: auto; }

/* Primary button hover lift */
.wp-block-button__link.has-accent-background-color { transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; }
@media (hover: hover) {
	.wp-block-button__link.has-accent-background-color:hover {
		transform: translateY(-2px);
		box-shadow: var(--wp--preset--shadow--elevated);
	}
}

/* Post cards (index/archive grids) */
.si-post-card {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	box-shadow: var(--wp--preset--shadow--card);
}
@media (hover: hover) {
	.si-post-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
	.si-post-card:hover { transform: translateY(-2px); box-shadow: var(--wp--preset--shadow--elevated); }
}

/* ==========================================================================
   SI Signals Carousel (.si-carousel) — see assets/js/carousel.js
   ========================================================================== */

.si-carousel__header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--md);
}

.si-carousel__arrows { display: none; gap: var(--wp--preset--spacing--xs); }
.si-carousel.is-enhanced .si-carousel__arrows { display: flex; }
@media (max-width: 781px) {
	.si-carousel.is-enhanced .si-carousel__arrows { display: none; }
}

.si-carousel__arrow {
	appearance: none;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 999px;
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--medium);
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease;
}
.si-carousel__arrow:hover { border-color: var(--wp--preset--color--accent-secondary); }
.si-carousel__arrow:disabled { color: var(--wp--preset--color--muted); cursor: default; border-color: var(--wp--preset--color--border); }

.si-carousel .wp-block-post-template {
	display: flex;
	flex-wrap: nowrap;
	gap: var(--wp--preset--spacing--md);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-left: max(var(--wp--preset--spacing--section-x), calc((100vw - 1400px) / 2));
	padding-right: var(--wp--preset--spacing--section-x);
	padding-bottom: var(--wp--preset--spacing--xs);
	scrollbar-width: none;
}
.si-carousel .wp-block-post-template::-webkit-scrollbar { display: none; }
.si-carousel .wp-block-post-template > li {
	flex: 0 0 clamp(240px, 26vw, 380px);
	scroll-snap-align: start;
	display: flex;
}
@media (max-width: 781px) {
	.si-carousel .wp-block-post-template > li { flex-basis: 78vw; }
}
@media (prefers-reduced-motion: no-preference) {
	.si-carousel .wp-block-post-template { scroll-behavior: smooth; }
}

.si-carousel__card {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	padding: var(--wp--preset--spacing--md);
	box-shadow: var(--wp--preset--shadow--card);
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--xs);
	width: 100%;
}
@media (hover: hover) {
	.si-carousel__card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
	.si-carousel__card:hover { transform: translateY(-2px); box-shadow: var(--wp--preset--shadow--elevated); }
}

.si-carousel__ghost { flex: 0 0 clamp(240px, 26vw, 380px); scroll-snap-align: start; display: flex; }
.si-carousel__ghost a {
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	width: 100%;
	border: 1.5px dashed var(--wp--preset--color--accent-secondary);
	border-radius: 12px;
	background: var(--wp--preset--color--tint);
	color: var(--wp--preset--color--accent-secondary);
	font-weight: 600;
	text-decoration: none;
	padding: var(--wp--preset--spacing--md);
}
.si-carousel__ghost a:hover { color: var(--wp--preset--color--accent); border-color: var(--wp--preset--color--accent); }

.si-carousel__progress {
	height: 2px;
	background: var(--wp--preset--color--border);
	border-radius: 999px;
	overflow: hidden;
	margin-top: var(--wp--preset--spacing--sm);
	display: none;
}
.si-carousel.is-enhanced .si-carousel__progress { display: block; }
.si-carousel__progress-fill { display: block; height: 100%; width: 0; background: var(--wp--preset--color--accent); border-radius: 999px; }

.si-carousel.is-grid .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	overflow: visible;
	padding-left: 0;
	padding-right: 0;
}
.si-carousel.is-grid .wp-block-post-template > li { flex: none; }
.si-carousel.is-grid .si-carousel__arrows,
.si-carousel.is-grid .si-carousel__progress { display: none; }

/* ==========================================================================
   Footer
   ========================================================================== */

.si-footer__logo img { height: 30px; width: auto; filter: brightness(0) invert(1); }
.si-footer__blurb { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted); max-width: 260px; line-height: 1.6; }
.si-footer__heading {
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
	margin-bottom: 0.5em;
}
.si-footer__links { line-height: 2.1; font-size: var(--wp--preset--font-size--small); }
.si-footer__links a { color: var(--wp--preset--color--on-dark-secondary); text-decoration: none; transition: color 0.2s ease; }
.si-footer__links a:hover { color: var(--wp--preset--color--white); }
.si-footer__links a.si-footer__link-highlight { color: var(--wp--preset--color--accent-light); font-weight: 600; }
.si-footer__rule { border-color: rgba(255,255,255,0.12); margin-top: var(--wp--preset--spacing--lg); margin-bottom: var(--wp--preset--spacing--md); }
.si-footer__legal-links a { color: var(--wp--preset--color--muted); text-decoration: none; }
.si-footer__legal-links a:hover { color: var(--wp--preset--color--on-dark-secondary); }

/* ==========================================================================
   P0: Focus states as brand
   ========================================================================== */

a:focus-visible,
button:focus-visible,
input:focus-visible,
.wp-block-button__link:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ==========================================================================
   Homepage: tiered evidence log
   ========================================================================== */

/* Lead Signal band */
.si-lead .wp-block-post-template { display: block; }
.si-lead__card { border-bottom: 1px solid var(--wp--preset--color--border); padding-bottom: var(--wp--preset--spacing--lg); }

/* RSS / briefings row */
.si-briefings-row {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--sm);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}
.si-briefings-row a { color: var(--wp--preset--color--accent-secondary); font-weight: 600; text-decoration: none; }
.si-briefings-row a:hover { color: var(--wp--preset--color--accent); }

/* Domain rail: core/categories restyled as governed-taxonomy chips */
.si-domain-rail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5em; }
.si-domain-rail li { margin: 0; }
.si-domain-rail a {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 999px;
	background: var(--wp--preset--color--surface);
	padding: 0.4em 1em;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	color: var(--wp--preset--color--foreground-secondary);
	text-decoration: none;
	transition: border-color 0.2s ease, color 0.2s ease;
}
.si-domain-rail a::before {
	content: "";
	width: 6px; height: 6px;
	border-radius: 999px;
	background: var(--wp--preset--color--accent-light);
}
.si-domain-rail a:hover { border-color: var(--wp--preset--color--accent-secondary); color: var(--wp--preset--color--foreground); }
.si-domain-rail .wp-block-categories__post-count { color: var(--wp--preset--color--muted); font-size: 0.85em; }
.si-domain-rail.is-hidden { display: none; }

/* Ledger: date-first evidence rows */
.si-ledger .wp-block-post-template { display: block; }
.si-ledger__row {
	display: grid;
	grid-template-columns: 110px 200px 1fr;
	gap: var(--wp--preset--spacing--sm);
	align-items: baseline;
	padding: 0.9em 0.5em;
	border-bottom: 1px solid var(--wp--preset--color--border);
	transition: background 0.2s ease;
}
.si-ledger__row:hover { background: color-mix(in srgb, var(--wp--preset--color--tint) 40%, transparent); }
.si-ledger__row:hover .wp-block-post-title a { color: var(--wp--preset--color--accent); }
.si-ledger__row .wp-block-post-title a { text-decoration: none; color: var(--wp--preset--color--foreground); transition: color 0.2s ease; }
@media (max-width: 781px) {
	.si-ledger__row { grid-template-columns: 1fr; gap: 0.25em; }
}

/* ==========================================================================
   Article instrumentation
   ========================================================================== */

/* Reading progress bar (injected by carousel.js on .si-article pages) */
.si-read-progress {
	position: fixed;
	top: 0; left: 0; right: 0;
	height: 2px;
	background: transparent;
	z-index: 60;
	pointer-events: none;
}
.si-read-progress span { display: block; height: 100%; width: 0; background: var(--wp--preset--color--accent); }

/* Briefing Summary block */
.si-briefing-summary {
	border: 1px solid var(--wp--preset--color--border);
	border-left: 3px solid var(--wp--preset--color--accent);
	border-radius: 12px;
	background: var(--wp--preset--color--surface);
	padding: var(--wp--preset--spacing--md);
}
.si-briefing-summary__label {
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent-secondary);
	margin-bottom: 0.25em;
}

/* Byline label */
.si-byline-label { font-size: var(--wp--preset--font-size--small); color: var(--wp--preset--color--muted); }

/* Cite-this-briefing record */
.si-cite {
	border: 1px dashed var(--wp--preset--color--accent-secondary);
	border-radius: 12px;
	background: var(--wp--preset--color--tint);
	padding: var(--wp--preset--spacing--md);
	font-size: var(--wp--preset--font-size--small);
}
.si-cite__label {
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent-secondary);
}
.si-copy-link {
	appearance: none;
	border: 1px solid var(--wp--preset--color--accent-secondary);
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--foreground);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	padding: 0.5em 1em;
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease;
}
.si-copy-link:hover { border-color: var(--wp--preset--color--accent); color: var(--wp--preset--color--accent); }

/* Header search */
.si-header-search .wp-block-search__input {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	font-size: var(--wp--preset--font-size--small);
	padding: 0.45em 0.9em;
}
.si-header-search .wp-block-search__button {
	border-radius: 8px;
	border: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--accent);
}

/* ==========================================================================
   Print: every briefing is a distributable artifact
   ========================================================================== */

@media print {
	header.wp-block-group,
	footer.wp-block-group,
	.si-carousel,
	.si-read-progress,
	.si-copy-link,
	.wp-block-search { display: none !important; }
	body { background: #fff !important; color: #000 !important; }
	main { padding: 0 !important; }
	a { color: #000 !important; text-decoration: underline; }
	.wp-block-post-content a::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #444; }
	.si-briefing-summary { border: 1px solid #000; border-left: 3px solid #000; }
	.si-cite { border: 1px dashed #000; background: #fff; }
}
