/**
 * The Perfect Query — custom styles.
 *
 * Only styles that cannot be expressed in theme.json belong here.
 * Keep this file as small as possible.
 */

/* Code blocks: match terminal aesthetic */
.wp-block-code code,
pre.wp-block-preformatted {
	tab-size: 2;
	-moz-tab-size: 2;
}

/* Post title links: no underline in listings */
.wp-block-post-title a {
	text-decoration: none;
}

.wp-block-post-title a:hover {
	color: var(--wp--preset--color--accent);
}

/* Navigation: active state */
.wp-block-navigation a[aria-current="page"] {
	color: var(--wp--preset--color--accent);
}

.wp-block-navigation a[aria-current="page"]::before {
	content: "> ";
}

/* Post terms: no bullets in category list */
.wp-block-post-terms {
	padding: 0;
	list-style: none;
}

/* Separator: thin line */
.wp-block-separator {
	border-top: none;
	border-bottom: 1px solid var(--wp--preset--color--border);
	opacity: 1;
}

/* Selection color */
::selection {
	background: var(--wp--preset--color--accent-soft);
	color: var(--wp--preset--color--foreground);
}

/* Scroll margin for anchor links */
h2[id],
h3[id],
h4[id] {
	scroll-margin-top: 2rem;
}

/* Inline code */
:not(pre) > code {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.875em;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 3px;
	padding: 0.15em 0.35em;
}

/* Blockquote: terminal-style left border */
.wp-block-quote {
	border-left: 3px solid var(--wp--preset--color--border);
	padding-left: var(--wp--preset--spacing--40);
	color: var(--wp--preset--color--secondary);
	font-style: normal;
}

/* ------------------------------------------------------------------
 * Dark theme
 * ------------------------------------------------------------------ */

:root {
	color-scheme: dark;
}

/* Titles read as text, not links */
.wp-block-site-title a,
.wp-block-post-title a {
	color: var(--wp--preset--color--foreground);
	text-decoration: none;
}

/* Header: solid, sticky */
header.wp-block-group {
	position: sticky;
	top: 0;
	z-index: 40;
	background: var(--wp--preset--color--background);
}

.admin-bar header.wp-block-group {
	top: var(--wp-admin--admin-bar--height, 32px);
}

/* Navigation: plain links, amber on hover */
.wp-block-navigation .wp-block-navigation-item__content {
	color: var(--wp--preset--color--secondary);
	text-decoration: none;
}

.wp-block-navigation .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--accent);
}

/* SQL syntax colours, shared by the console and list heading */
.tpq-sql-k { color: var(--wp--preset--color--accent); }
.tpq-sql-s { color: var(--wp--preset--color--accent-2); }
.tpq-sql-n { color: var(--wp--preset--color--accent-3); }
.tpq-sql-o { color: var(--wp--preset--color--muted); }

/* ------------------------------------------------------------------
 * Hero
 * ------------------------------------------------------------------ */

.tpq-hero {
	padding-top: 4.5rem;
	padding-bottom: 4rem;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.tpq-hero > * {
	margin-block: 0;
}

.tpq-hero__kicker {
	font-size: 0.8125rem;
	color: var(--wp--preset--color--muted);
	margin-bottom: 1.25rem !important;
}

.tpq-hero__title {
	font-size: clamp(1.75rem, 5vw, 2.5rem);
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1.15;
	margin-bottom: 1.25rem !important;
}

.tpq-hero__title em {
	font-style: normal;
	color: var(--wp--preset--color--accent);
}

.tpq-hero__bio {
	font-size: 1.0625rem;
	line-height: 1.75;
	margin-bottom: 2.5rem !important;
}

/* Console panel */
.tpq-console {
	margin: 0 0 2rem;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 6px;
	overflow: hidden;
	font-family: var(--wp--preset--font-family--mono);
}

.tpq-console__bar {
	display: flex;
	justify-content: space-between;
	padding: 0.5rem 1rem;
	border-bottom: 1px solid var(--wp--preset--color--border);
	font-size: 0.75rem;
	color: var(--wp--preset--color--muted);
}

.tpq-console__title {
	color: var(--wp--preset--color--secondary);
}

.tpq-console__body {
	margin: 0;
	padding: 1.25rem 1rem;
	overflow-x: auto;
	font-size: 0.875rem;
	line-height: 1.7;
	color: var(--wp--preset--color--foreground);
	background: none;
	border: 0;
}

.tpq-console__body code {
	font: inherit;
	background: none;
	border: 0;
	padding: 0;
}

.tpq-cursor {
	display: inline-block;
	width: 0.6em;
	height: 1.1em;
	margin-left: 0.15em;
	vertical-align: text-bottom;
	background: var(--wp--preset--color--accent);
	animation: tpq-blink 1.1s steps(1) infinite;
}

@keyframes tpq-blink {
	50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.tpq-cursor { animation: none; }
}

.tpq-console__result {
	padding: 0.625rem 1rem;
	border-top: 1px dashed var(--wp--preset--color--border);
	font-size: 0.8125rem;
}

.tpq-console__result a {
	color: var(--wp--preset--color--muted);
	text-decoration: none;
}

.tpq-console__result a:hover {
	color: var(--wp--preset--color--accent);
}

/* Plain text links under the console */
.tpq-hero__links {
	gap: 0.25rem 1.5rem;
	font-size: 0.8125rem;
}

.tpq-hero__links p {
	margin: 0;
}

.tpq-hero__links a {
	color: var(--wp--preset--color--secondary);
	text-decoration: none;
}

.tpq-hero__links a::before {
	content: "→ ";
	color: var(--wp--preset--color--muted);
}

.tpq-hero__links a:hover {
	color: var(--wp--preset--color--accent);
}

/* ------------------------------------------------------------------
 * Post list as query result rows
 * ------------------------------------------------------------------ */

.tpq-list-heading {
	font-size: 0.8125rem;
	font-weight: 400;
	color: var(--wp--preset--color--muted);
	margin: 0 0 1rem;
}

.tpq-row {
	display: grid;
	grid-template-columns: 6.5rem 1fr;
	gap: 0 1.5rem;
	padding: 1.25rem 0;
	border-top: 1px solid var(--wp--preset--color--border);
}

.tpq-rows > li:last-child .tpq-row {
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.tpq-row__date {
	padding-top: 0.2rem;
	font-size: 0.8125rem;
	color: var(--wp--preset--color--muted);
}

.tpq-row__body > * {
	margin-block: 0;
}

.tpq-row__title {
	font-size: 1.125rem;
	font-weight: 500;
	line-height: 1.4;
}

.tpq-row:hover .tpq-row__title a {
	color: var(--wp--preset--color--accent);
}

.tpq-row__excerpt {
	margin-top: 0.375rem !important;
	font-size: 0.9375rem;
	line-height: 1.6;
}

.tpq-row__excerpt p {
	margin: 0;
}

.tpq-row__terms {
	margin-top: 0.5rem !important;
	font-size: 0.75rem;
}

.tpq-row__terms a {
	color: var(--wp--preset--color--muted);
	text-decoration: none;
}

.tpq-row__terms a::before {
	content: "#";
}

.tpq-row__terms a:hover {
	color: var(--wp--preset--color--accent);
}

@media (max-width: 600px) {
	.tpq-row {
		grid-template-columns: 1fr;
	}
}
