/*
Theme Name: Castle Niche
Theme URI: https://www.castlemotors.com
Author: CodeCasa Studios
Description: Shared theme for Castle Motors' niche SEO sites (Jimny, Defender, Porsche). Copy and behaviour come from config/<niche>.php, selected by the CASTLE_NICHE constant.
Version: 2.2.0
Requires at least: 6.0
Requires PHP: 8.0
License: Proprietary
Text Domain: castle-niche
*/

/* Brand tokens lifted from castlemotors.com's computed styles so the niche site
   reads as part of the same business. Do not drift from these. */
:root {
	--yellow: #FECD00;
	--ink: #2F2F2F;
	--ink-soft: #555;
	--muted: #999;
	--green: #4FBA6F;
	--surface: #FFFFFF;
	--surface-alt: #F5F5F5;
	--line: #E4E4E4;
	--radius: 6px;
	--wrap: 1180px;
	--font: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

body {
	margin: 0;
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.6;
	color: var(--ink);
	background: var(--surface);
	-webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: #0057c8; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.15rem; font-weight: 700; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.section { padding: 3.5rem 0; }
.muted { color: var(--ink-soft); }
.small { font-size: .82rem; }

.skip-link {
	position: absolute; left: -9999px;
	background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* Visible focus everywhere — keyboard users must be able to see where they are. */
a:focus-visible, button:focus-visible {
	outline: 3px solid var(--yellow);
	outline-offset: 2px;
}

/* ---------- buttons ---------- */
.btn {
	display: inline-block; padding: .8rem 1.4rem; border-radius: var(--radius);
	font-weight: 800; text-decoration: none; font-size: .95rem;
	transition: transform .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--yellow); color: var(--ink); }
.btn--primary:hover { background: #ffd83a; }
.btn--ghost { border: 2px solid currentColor; color: inherit; }

/* ---------- header ---------- */
.site-header { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 50; }
.header-inner {
	display: flex; align-items: center; gap: 1.5rem;
	min-height: 74px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: #fff; margin-right: auto; }
.brand__mark {
	width: 34px; height: 34px; border-radius: 4px; flex: 0 0 auto;
	background: var(--yellow);
	/* Simple castle silhouette — avoids hotlinking Castle Motors' logo file. */
	clip-path: polygon(0 100%,0 38%,14% 38%,14% 20%,28% 20%,28% 38%,42% 38%,42% 12%,58% 12%,58% 38%,72% 38%,72% 20%,86% 20%,86% 38%,100% 38%,100% 100%);
}
.brand__text strong { display: block; font-size: 1.05rem; letter-spacing: -.01em; }
.brand__text small { display: block; color: var(--yellow); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }

.site-nav ul { display: flex; gap: 1.3rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: .93rem; }
.site-nav a:hover { color: var(--yellow); }

.header-cta { display: flex; align-items: center; gap: 1rem; }
.header-cta .tel { color: var(--yellow); font-weight: 800; text-decoration: none; font-size: 1.05rem; white-space: nowrap; }

/* ---------- hero ---------- */
.hero { background: var(--ink); color: #fff; padding: 3.5rem 0 4rem; }
.hero h1 { color: #fff; }
.hero__lead { font-size: 1.15rem; max-width: 62ch; color: #E8E8E8; }
.hero__lead strong { color: var(--yellow); }
.hero__stat { font-size: 1.05rem; color: #E8E8E8; }
.hero__stat strong { color: var(--yellow); font-size: 1.35rem; }
.hero__actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero__actions .btn--ghost { color: #fff; }

/* ---------- stock grid ---------- */
.stock-heading { margin-bottom: 1.5rem; }
.stock-grid {
	display: grid; gap: 1.4rem;
	grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.stock-empty {
	background: var(--surface-alt); border: 1px solid var(--line);
	border-radius: var(--radius); padding: 1.5rem;
}

.vcard {
	border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
	background: var(--surface); transition: box-shadow .15s ease, transform .15s ease;
}
.vcard:hover { box-shadow: 0 8px 24px rgba(0,0,0,.11); transform: translateY(-2px); }
.vcard__link { text-decoration: none; color: inherit; display: block; height: 100%; }
.vcard__media { position: relative; aspect-ratio: 4 / 3; background: var(--surface-alt); }
.vcard__media img { width: 100%; height: 100%; object-fit: cover; }
.vcard__count {
	position: absolute; right: .6rem; bottom: .6rem;
	background: rgba(47,47,47,.86); color: #fff;
	font-size: .72rem; font-weight: 700; padding: .2rem .5rem; border-radius: 3px;
}
.vcard__body { padding: 1rem 1.1rem 1.2rem; }
.vcard__title { margin: 0 0 .15rem; font-size: 1.05rem; }
.vcard__deriv { margin: 0 0 .7rem; font-size: .84rem; color: var(--ink-soft); line-height: 1.35; }
.vcard__spec {
	list-style: none; display: flex; flex-wrap: wrap; gap: .35rem;
	margin: 0 0 .9rem; padding: 0;
}
.vcard__spec li {
	background: var(--surface-alt); border-radius: 3px;
	padding: .16rem .5rem; font-size: .76rem; color: var(--ink-soft);
}
.vcard__foot { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.vcard__price { font-size: 1.45rem; font-weight: 800; }
.vcard__finance { font-size: .78rem; color: var(--ink-soft); }
.vcard__cta { display: inline-block; margin-top: .8rem; font-weight: 800; font-size: .86rem; color: #0057c8; }

/* ---------- generic layout bits ---------- */
.cols { display: grid; gap: 1.8rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.cards { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
	display: block; text-decoration: none; color: inherit;
	border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem;
	background: var(--surface); transition: border-color .15s ease;
}
.card:hover { border-color: var(--yellow); }
.card h2, .card h3 { font-size: 1.08rem; margin-bottom: .4rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: .9rem; }

/* ---------- prose ---------- */
.prose { max-width: 74ch; }
.prose p, .prose li { font-size: 1.05rem; }
.prose h2 { margin-top: 2.2rem; }
.prose h3 { margin-top: 1.6rem; }
.prose .meta { color: var(--muted); font-size: .85rem; margin-top: -.4rem; }
.prose blockquote {
	margin: 1.6rem 0; padding: .4rem 0 .4rem 1.2rem;
	border-left: 4px solid var(--yellow); color: var(--ink-soft);
}
/* Stock grids inside articles break out of the prose measure. */
.prose .stock-grid { max-width: none; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #D8D8D8; margin-top: 3rem; padding: 3rem 0 1.5rem; }
.site-footer h3 { color: #fff; font-size: 1rem; }
.site-footer a { color: var(--yellow); }
.site-footer address { font-style: normal; }
/* --ink-soft (#555) is a light-background token; on the dark footer it lands at
   ~1.5:1 against #2F2F2F, far below WCAG AA. Override with a light grey. */
.site-footer .muted { color: #B9B9B9; }
.site-footer .muted.small { color: #A0A0A0; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .4rem; }
.footer-base {
	border-top: 1px solid rgba(255,255,255,.14);
	margin-top: 2rem; padding-top: 1.2rem;
	font-size: .82rem; color: var(--muted);
}

@media (max-width: 720px) {
	.header-inner { min-height: 0; padding: .8rem 0; }
	.site-nav { order: 3; width: 100%; }
	.site-nav ul { flex-wrap: wrap; gap: .9rem; }
	.header-cta .btn { display: none; }
	.section { padding: 2.4rem 0; }
}

/* A vehicle whose price element holds a status ("DEPOSIT TAKEN") rather than a
   figure. Rendered smaller and muted so it does not read as a price. */
.vcard__price--status {
	font-size: 1rem;
	font-weight: 700;
	color: var(--ink-soft);
	text-transform: uppercase;
	letter-spacing: .04em;
}
