/*
Theme Name: CalcQuarry
Theme URI: https://calcquarry.com/
Author: CalcQuarry
Author URI: https://calcquarry.com/
Description: Fast theme for CalcQuarry with built-in construction and home-project calculators, category hubs and trust pages. After activating, open Appearance → CalcQuarry Setup to create the pages, the main menu and the home page in one click. Works with Rank Math or Yoast SEO; the theme adds no SEO tags of its own while one of them is active.
Version: 1.0.0
Requires at least: 6.0
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: calcquarry
Tags: one-column, two-columns, right-sidebar, custom-logo, custom-menu
*/

/* ---------- Tokens (light theme; no web fonts, no external requests) ---------- */

:root {
	color-scheme: light;
	--bg: #f8f7f4;
	--surface: #ffffff;
	--subtle: #f2f0eb;
	--border: #e4e0d8;
	--border-strong: #cfc9bf;
	--text: #1c1a17;
	--muted: #5d5850;
	--accent: #c2410c;
	--accent-hover: #9a3412;
	--accent-ink: #ffffff;
	--accent-soft: #fff1e6;
	--warn: #854d0e;
	--warn-soft: #fdf6e3;
	--link: #9a3412;
	--focus: #2563eb;
	--shadow: 0 1px 2px rgb(28 26 23 / 0.05), 0 6px 20px rgb(28 26 23 / 0.05);
	--radius: 14px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

	/* The calculators read these; kept in step with the site palette. */
	--cq-accent: var(--accent);
	--cq-accent-hover: var(--accent-hover);
	--cq-accent-soft: var(--accent-soft);
	--cq-surface: var(--surface);
	--cq-subtle: #f4f2ee;
	--cq-border: var(--border);
	--cq-border-strong: var(--border-strong);
	--cq-text: var(--text);
	--cq-muted: var(--muted);
	--cq-mono: var(--mono);
}

/* ---------- Base ---------- */

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

[hidden] {
	display: none !important;
}

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 1.0625rem;
	line-height: 1.6;
	text-rendering: optimizeLegibility;
}

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

a {
	color: var(--link);
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
}

a:hover {
	color: var(--accent-hover);
}

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

h1,
h2,
h3,
h4 {
	line-height: 1.2;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

h1 {
	font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
	margin: 0.2em 0 0.35em;
}

.skip-link {
	position: absolute;
	left: -999px;
	top: 8px;
	background: var(--surface);
	padding: 8px 12px;
	z-index: 100;
	border-radius: 8px;
}

.skip-link:focus {
	left: 8px;
}

.container {
	width: 100%;
	max-width: 1160px;
	margin-inline: auto;
	padding-inline: 16px;
}

@media (min-width: 720px) {
	.container {
		padding-inline: 24px;
	}
}

.screen-reader-text,
.visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	position: static !important;
	width: auto;
	height: auto;
	margin: 0;
	clip: auto;
}

/* ---------- Header ---------- */

.site-header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}

.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 62px;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--text);
	text-decoration: none;
	font-weight: 800;
	font-size: 1.2rem;
	letter-spacing: -0.02em;
}

.brand:hover {
	color: var(--text);
}

.brand svg {
	width: 32px;
	height: 32px;
	flex: none;
}

.brand b {
	color: var(--accent);
	font-weight: 800;
}

.custom-logo-link {
	display: inline-flex;
	align-items: center;
}

.custom-logo {
	max-height: 44px;
	width: auto;
}

.nav-desktop {
	display: none;
}

.nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.nav-desktop .nav-list {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
}

.nav-list .sub-menu {
	display: none;
}

.nav-desktop a,
.menu-panel a {
	display: block;
	padding: 8px 12px;
	border-radius: 8px;
	color: var(--text);
	text-decoration: none;
	font-weight: 560;
	font-size: 0.97rem;
}

.nav-desktop a:hover,
.menu-panel a:hover,
.nav-desktop a[aria-current="page"],
.menu-panel a[aria-current="page"] {
	background: var(--subtle);
	color: var(--text);
}

.menu-toggle {
	position: relative;
}

.menu-toggle summary {
	list-style: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: 1px solid var(--border-strong);
	border-radius: 10px;
	font-weight: 600;
	font-size: 0.95rem;
	user-select: none;
}

.menu-toggle summary::-webkit-details-marker {
	display: none;
}

.menu-panel {
	position: absolute;
	right: 0;
	top: calc(100% + 8px);
	width: min(290px, calc(100vw - 32px));
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	box-shadow: var(--shadow);
	padding: 8px;
	z-index: 20;
}

@media (min-width: 960px) {
	.nav-desktop {
		display: block;
	}

	.menu-toggle {
		display: none;
	}
}

/* ---------- Breadcrumbs (theme trail, or the SEO plugin's when it has breadcrumbs switched on) ---------- */

.breadcrumbs {
	font-size: 0.9rem;
	color: var(--muted);
	margin: 18px 0 0;
}

.breadcrumbs ol {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 6px;
	margin: 0;
	padding: 0;
}

.breadcrumbs li:not(:last-child)::after {
	content: "›";
	margin-left: 6px;
	color: var(--border-strong);
}

.breadcrumbs a {
	color: var(--muted);
}

/* Rank Math and Yoast print their trail as a paragraph or spans. */
.breadcrumbs p,
.breadcrumbs .rank-math-breadcrumb p {
	margin: 0;
}

.page-links {
	margin: 1.5em 0;
}

/* ---------- Page layout ---------- */

main {
	display: block;
	padding-bottom: 56px;
}

.page-grid {
	display: grid;
	gap: 32px;
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1100px) {
	.page-grid {
		grid-template-columns: minmax(0, 1fr) 300px;
	}
}

.lede,
.cq-lede {
	font-size: 1.02rem;
	color: var(--muted);
	margin: 0 0 14px;
	max-width: 68ch;
}

@media (min-width: 720px) {
	.lede,
	.cq-lede {
		font-size: 1.12rem;
		margin-bottom: 18px;
	}
}

.meta-line {
	font-size: 0.88rem;
	color: var(--muted);
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin: 0 0 20px;
}

/* ---------- Content ---------- */

.entry-content > p,
.entry-content > ul,
.entry-content > ol,
.entry-content > h2,
.entry-content > h3,
.entry-content > h4,
.entry-content > blockquote,
.prose {
	max-width: 72ch;
}

.entry-content h2 {
	font-size: 1.5rem;
	margin: 2.2em 0 0.6em;
}

.entry-content h3 {
	font-size: 1.15rem;
	margin: 1.8em 0 0.4em;
}

.entry-content p,
.entry-content ul,
.entry-content ol {
	margin: 0 0 1em;
}

.entry-content li {
	margin: 0.3em 0;
}

.entry-content li::marker {
	color: var(--muted);
}

.entry-content > :first-child {
	margin-top: 0;
}

.entry-content blockquote {
	margin: 0 0 1.2em;
	padding: 4px 16px;
	border-left: 4px solid var(--border-strong);
	color: var(--muted);
}

pre.cq-formula,
.entry-content pre {
	font-family: var(--mono);
	font-size: 0.93rem;
	line-height: 1.55;
	color: var(--text);
	background: var(--subtle);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 12px 14px;
	margin: 0 0 1.2em;
	white-space: pre-wrap;
	overflow-x: auto;
}

.cq-example {
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 4px solid var(--accent);
	border-radius: 10px;
	padding: 14px 18px;
	margin: 0 0 1.2em;
}

.cq-example ol,
.cq-example ul {
	margin-bottom: 0;
}

.cq-callout {
	border-left: 4px solid var(--accent);
	background: var(--accent-soft);
	padding: 12px 16px;
	border-radius: 0 10px 10px 0;
	margin: 0 0 1.2em;
}

.cq-callout p:last-child {
	margin-bottom: 0;
}

.cq-table-wrap {
	overflow-x: auto;
	margin: 0 0 1.2em;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--surface);
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
	font-variant-numeric: tabular-nums;
}

th,
td {
	text-align: left;
	padding: 9px 12px;
	border-bottom: 1px solid var(--border);
	vertical-align: top;
}

th {
	background: var(--subtle);
	font-weight: 650;
}

tr:last-child td {
	border-bottom: 0;
}

.cq-table-wrap table {
	margin: 0;
}

.cq-used {
	display: block;
	color: var(--muted);
	font-size: 0.9rem;
}

.cq-related,
.card-grid {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	list-style: none;
	margin: 0 0 1.5em;
	padding: 0;
}

.cq-related li,
.card-grid li {
	margin: 0;
	padding: 0;
}

.cq-related a,
.card {
	display: block;
	height: 100%;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 14px 16px;
	color: var(--text);
	text-decoration: none;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.cq-related a:hover,
.cq-related a:focus,
.card:hover,
.card:focus {
	border-color: var(--accent);
	color: var(--text);
	transform: translateY(-1px);
}

.cq-related strong,
.card strong {
	display: block;
	font-size: 1.02rem;
	margin-bottom: 2px;
}

.cq-related span,
.card span {
	display: block;
	color: var(--muted);
	font-size: 0.92rem;
	line-height: 1.45;
}

/* WordPress core classes */

.alignleft {
	float: left;
	margin: 0.3em 1.2em 1em 0;
}

.alignright {
	float: right;
	margin: 0.3em 0 1em 1.2em;
}

.aligncenter {
	display: block;
	margin-inline: auto;
}

.wp-caption {
	max-width: 100%;
}

.wp-caption-text,
.wp-element-caption {
	font-size: 0.88rem;
	color: var(--muted);
	margin-top: 6px;
}

/* ---------- Sidebar, hero, search, sections ---------- */

.side-box {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 16px;
	margin: 0 0 16px;
}

.side-box h2 {
	font-size: 1rem;
	margin: 0 0 8px;
}

.side-box ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.side-box li a {
	display: block;
	padding: 6px 0;
	color: var(--text);
	text-decoration: none;
	border-bottom: 1px solid var(--border);
}

.side-box li:last-child a {
	border-bottom: 0;
}

.side-box li a:hover {
	color: var(--accent);
}

.side-box .hint {
	font-size: 0.9rem;
	color: var(--muted);
	margin: 0;
}

.hero {
	padding: 36px 0 12px;
}

.hero .entry-content p {
	max-width: 62ch;
	color: var(--muted);
	font-size: 1.08rem;
}

.search-box {
	max-width: 520px;
	margin: 18px 0 8px;
}

.search-input,
.search-form .search-field {
	font: inherit;
	font-size: 1rem;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border-strong);
	border-radius: 10px;
	padding: 10px 12px;
	min-height: 46px;
	width: 100%;
	min-width: 0;
}

.search-input:focus,
.search-form .search-field:focus {
	outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
	outline-offset: 0;
	border-color: var(--accent);
}

.search-form {
	display: flex;
	gap: 8px;
	max-width: 520px;
}

.button,
.search-form .search-submit {
	font: inherit;
	font-weight: 650;
	font-size: 0.97rem;
	border: 1px solid var(--accent);
	background: var(--accent);
	color: var(--accent-ink);
	border-radius: 10px;
	padding: 10px 16px;
	min-height: 46px;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
}

.button:hover,
.search-form .search-submit:hover {
	background: var(--accent-hover);
	border-color: var(--accent-hover);
	color: var(--accent-ink);
}

.hint {
	font-size: 0.88rem;
	color: var(--muted);
	margin: 6px 0 0;
}

.section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 34px 0 12px;
}

.section-head h2 {
	margin: 0;
	font-size: 1.35rem;
}

.pill-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none;
	padding: 0;
	margin: 0 0 12px;
}

.pill-list a {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid var(--border-strong);
	border-radius: 999px;
	text-decoration: none;
	color: var(--text);
	font-size: 0.93rem;
	background: var(--surface);
}

.pill-list a:hover {
	border-color: var(--accent);
}

.trust {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	margin: 36px 0 0;
}

.trust div {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 14px 16px;
}

.trust strong {
	display: block;
	margin-bottom: 4px;
}

.trust p {
	margin: 0;
	color: var(--muted);
	font-size: 0.93rem;
}

/* ---------- Post lists, pagination, 404 ---------- */

.post-list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-width: 72ch;
}

.post-list > li {
	padding: 18px 0;
	border-bottom: 1px solid var(--border);
}

.post-list h2 {
	font-size: 1.25rem;
	margin: 0 0 6px;
}

.post-list h2 a {
	color: var(--text);
	text-decoration: none;
}

.post-list h2 a:hover {
	color: var(--accent);
}

.post-list p {
	margin: 0;
	color: var(--muted);
}

.navigation.pagination {
	margin: 28px 0 0;
}

.nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.nav-links .page-numbers {
	display: inline-block;
	min-width: 40px;
	padding: 8px 12px;
	border: 1px solid var(--border-strong);
	border-radius: 8px;
	text-align: center;
	text-decoration: none;
	color: var(--text);
	background: var(--surface);
}

.nav-links .page-numbers.current {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-ink);
}

/* ---------- Ads (containers render only after an AdSense ID is saved) ---------- */

.ad-slot {
	margin: 28px 0;
	min-height: 280px;
	text-align: center;
}

.ad-slot--sidebar {
	min-height: 600px;
}

.ad-slot .ad-label {
	display: block;
	font-size: 0.75rem;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-bottom: 4px;
}

/* ---------- Footer ---------- */

.site-footer {
	background: var(--surface);
	border-top: 1px solid var(--border);
	padding: 36px 0 28px;
	font-size: 0.93rem;
}

.footer-grid {
	display: grid;
	gap: 24px;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.site-footer h2 {
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--muted);
	margin: 0 0 8px;
}

.site-footer ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.site-footer li {
	margin: 4px 0;
}

.site-footer a {
	color: var(--text);
	text-decoration: none;
}

.site-footer a:hover {
	color: var(--accent);
	text-decoration: underline;
}

.footer-note {
	margin: 28px 0 0;
	padding-top: 18px;
	border-top: 1px solid var(--border);
	color: var(--muted);
	font-size: 0.87rem;
}

/* ---------- Print ---------- */

@media print {
	.site-header,
	.site-footer,
	.ad-slot,
	.page-grid > aside,
	.breadcrumbs,
	.search-box,
	.no-print {
		display: none !important;
	}

	body {
		background: #fff;
		color: #000;
	}

	.page-grid {
		display: block;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
	}
}
