/*
Theme Name: Caruth Jordanhill
Theme URI: https://www.caruthjordanhill.co.uk
Description: Kadence child theme for Caruth Jordanhill Ltd. Palette, type, header and footer live in the Customizer; this file only holds what Kadence cannot do.
Author: Jonathon Mills
Template: kadence
Version: 1.0.0
Requires PHP: 8.1
Text Domain: caruth-kadence
*/

/* Palette slots (set in Customizer > Colors): 1 brand blue #2F80ED, 2 coral, 3 ink, 4 body, 5 muted, 6 border, 7/8 light greys, 9 white. */

/* ---- Round logo overlapping utility + main header bars ---- */
.site-header .site-branding {
	position: relative;
	z-index: 10;
}
.site-header .site-branding .custom-logo {
	border-radius: 50%;
	background: var(--global-palette9);
	border: 4px solid var(--global-palette3);
	box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
@media (min-width: 1025px) {
	.site-header .site-branding {
		margin-top: -42px; /* reaches up into the top row */
		margin-bottom: -16px;
	}
}

/* ---- Utility bar: "Open today" dot, out-of-hours link ---- */
.cj-today {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.cj-today::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #45d483;
	flex: none;
}
.cj-today.is-closed::before {
	background: #ff5b3e;
}
/* Kadence top-aligns the row's sections; centre the utility row contents in its 40px height. */
.site-top-header-inner-wrap {
	align-content: center; /* the grid track is shorter than the row's min-height; centre the track */
}
.site-top-header-inner-wrap,
.site-top-header-inner-wrap .site-header-section,
.site-top-header-inner-wrap .site-header-item {
	align-items: center;
}
.site-header .cj-oo-hours,
.header-popup .cj-oo-hours,
.mobile-html .cj-oo-hours,
.cj-util__links a.cj-oo-hours {
	color: var(--global-palette2) !important; /* coral, as the "closed" accent */
}
/* The HTML element fills the top row; links sit right, "Open today" left.
   Kadence lays the row out as a 3-column grid (left / centre / right); collapse it to one column. */
.site-top-header-inner-wrap.site-header-row-has-sides {
	grid-template-columns: minmax(0, 1fr);
}
.site-top-header-wrap .site-header-section-left,
.site-top-header-wrap .site-header-item,
.site-top-header-wrap .header-html,
.site-top-header-wrap .header-html-inner {
	flex: 1 1 auto;
	width: 100%;
}
.cj-util {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px 24px;
	padding-left: 150px; /* clear the overlapping logo */
}
.cj-util__links {
	display: flex;
	gap: 20px;
}
.cj-util__links a,
.cj-util__links a:hover,
.cj-util__links a:focus {
	text-decoration: none;
	background: none;
	box-shadow: none;
	color: var(--global-palette9);
}
.cj-util__links a:hover,
.cj-util__links a:focus {
	color: var(--global-palette1);
}
@media (max-width: 1024px) {
	.cj-util {
		justify-content: flex-end;
		padding-left: 0;
	}
	.cj-util__links {
		display: none;
	}
}

/* ---- Header nav colours ---- */
.site-header .header-navigation a:hover,
.site-header .header-navigation .current-menu-item > a {
	color: var(--global-palette1);
}

/* ---- Buttons: filled and outline share one size (design: 18px, 16/26 padding, radius 14) ---- */
.kb-button.kt-btn-size-large {
	font-size: 18px !important;
}
.kb-button.kb-btn-global-outline {
	padding: 15px 22px !important; /* with the 2px border this matches the filled button's height */
	font-size: 18px !important;
	border-width: 2px !important;
	border-radius: 14px !important;
	line-height: 1.5;
}
@media (max-width: 767px) {
	.kb-button.kt-btn-size-large,
	.kb-button.kb-btn-global-outline {
		font-size: 16px !important;
	}
}

/* ---- Cards: lift on hover (Info Box + Posts) ---- */
.kt-info-box-link-wrap,
.cj-advice .entry {
	transition: transform .3s ease, box-shadow .3s ease;
}
.kt-info-box-link-wrap:hover,
.cj-advice .entry:hover {
	transform: translateY(-3px);
	box-shadow: 0 14px 30px rgba(17, 17, 17, .08);
}

/* ---- Pill labels (Advanced Heading with class cj-pill) ---- */
.cj-pill {
	/* !important: Kadence's per-block heading CSS otherwise resets these */
	display: inline-block !important;
	background: var(--global-palette1) !important;
	color: var(--global-palette9) !important;
	font-family: var(--global-heading-font-family) !important;
	font-weight: 500 !important;
	font-size: 14px !important;
	line-height: 1.4 !important;
	padding: 6px 14px !important;
	border-radius: 999px !important;
	width: fit-content !important;
	align-self: flex-start;
}
.cj-pill--dark {
	background: var(--global-palette3) !important;
	color: var(--global-palette9) !important;
}
.cj-pill--white {
	background: var(--global-palette3) !important;
	color: var(--global-palette9) !important;
}

/* ---- Service cards (Info Box) ---- */
.cj-card.kt-info-box-link-wrap,
.cj-card .kt-blocks-info-box-link-wrap {
	overflow: hidden;
}
.cj-card .kt-blocks-info-box-learnmore::after {
	content: "→";
	color: var(--global-palette2);
	font-weight: 700;
	margin-left: 10px;
}
.cj-textlink a {
	text-decoration: none;
}
.cj-textlink a:hover {
	text-decoration: underline;
}

/* ---- Story image with brand-colour offset block ---- */
.cj-offset {
	position: relative;
	z-index: 0;
}
.cj-offset img {
	position: relative;
	z-index: 1;
}
.cj-offset::after {
	content: "";
	position: absolute;
	right: -18px;
	bottom: -18px;
	width: 62%;
	height: 62%;
	background: var(--global-palette1);
	border-radius: 24px;
	z-index: -1;
}

/* ---- Prose columns on inner pages (converted legacy copy) ---- */
.cj-prose h2 {
	font-size: 32px;
	line-height: 1.15;
	margin: 32px 0 12px;
}
.cj-prose h3 {
	font-size: 24px;
	line-height: 1.2;
	margin: 28px 0 10px;
}
.cj-prose p,
.cj-prose li {
	font-size: 17px;
}
.cj-prose img {
	border-radius: 20px;
}

/* ---- Booking / visit helpers ---- */
.cj-map iframe {
	border-radius: 20px;
}
.cj-book-card .cj-form-note {
	border-top: 1px dashed var(--global-palette6);
	padding-top: 14px;
}
@media (max-width: 767px) {
	.cj-hide-mobile {
		display: none !important;
	}
}

/* ---- Opening hours table from [cj_hours] ---- */
.cj-hours {
	width: 100%;
	max-width: 440px;
	border: 1px solid var(--global-palette6);
	border-radius: 16px;
	padding: 8px 22px;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 17px;
}
.cj-hours caption {
	text-align: left;
	font-family: var(--global-heading-font-family);
	font-weight: 600;
	font-size: 15px;
	padding: 14px 0 6px;
}
.cj-hours th,
.cj-hours td {
	padding: 11px 0;
	border-top: 1px solid var(--global-palette6);
	background: none;
}
.cj-hours th {
	text-align: left;
	font-weight: 400;
}
.cj-hours td {
	text-align: right;
	font-weight: 600;
}
.cj-hours .cj-closed {
	color: #b3301a;
}

/* ---- Advice cards (Kadence Posts block, 2 columns) ---- */
.cj-advice .entry {
	background: var(--global-palette1);
	color: var(--global-palette9);
	border-radius: 20px;
	padding: 30px 30px 32px;
	box-shadow: none;
}
.cj-advice .entry-title {
	font-size: 28px;
	line-height: 1.15;
	letter-spacing: -0.02em;
}
.cj-advice .entry-taxonomies a {
	display: inline-block;
	background: var(--global-palette3);
	color: var(--global-palette9);
	font-family: var(--global-heading-font-family);
	font-weight: 500;
	font-size: 13px;
	padding: 5px 12px;
	border-radius: 999px;
}

/* ---- Mobile sticky action bar (output in wp_footer) ---- */
.cj-bottom-bar {
	display: none;
}
@media (max-width: 767px) {
	body {
		padding-bottom: 72px;
	}
	.cj-bottom-bar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 90;
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 10px;
		padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
		background: rgba(255, 255, 255, .96);
		border-top: 1px solid var(--global-palette6);
		box-shadow: 0 -8px 24px rgba(17, 17, 17, .08);
	}
	.cj-bottom-bar a {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 48px;
		border-radius: 12px;
		font-family: var(--global-heading-font-family);
		font-weight: 600;
		font-size: 16px;
		text-decoration: none;
	}
	.cj-bottom-bar .cj-bottom-bar__call {
		border: 2px solid var(--global-palette3);
		color: var(--global-palette3);
	}
	.cj-bottom-bar .cj-bottom-bar__book {
		background: var(--global-palette3);
		color: var(--global-palette9);
	}
}

/* ---- Footer ---- */
.site-footer .site-footer-wrap a {
	text-decoration: none;
}
.cj-footer-tagline {
	color: var(--global-palette1);
	font-family: var(--global-heading-font-family);
	font-weight: 500;
	font-size: 14px;
}
.cj-footer-logo {
	border-radius: 50%;
	background: var(--global-palette9);
	width: 120px;
	height: 120px;
}
.np {
	text-decoration: none;
	white-space: nowrap;
}
.np-word {
	font-family: Outfit, "Avenir Next", var(--global-heading-font-family), sans-serif;
	font-weight: 700;
	font-size: 18px;
	letter-spacing: -0.02em;
	line-height: 1;
	margin-left: 6px;
}
.np-neon {
	color: var(--global-palette9);
}
.np-grad {
	background: linear-gradient(90deg, #e93e85, #eb705d);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

/* ---- Brand gradient on the big blue surfaces (hero row carries it as a Kadence gradient; title band via CSS) ---- */
.page-hero-section .entry-hero-container-inner,
.post-hero-section .entry-hero-container-inner {
	background: linear-gradient(135deg, #4169E1 0%, #3A5DC7 55%, #2B4594 100%) !important;
}

/* ---- Text on brand-blue surfaces is white ---- */
.cj-advice .entry .entry-title a,
.cj-advice .entry .entry-content,
.cj-advice .entry .entry-summary {
	color: var(--global-palette9);
}
.cj-card-brand,
.cj-card-brand a {
	color: var(--global-palette9);
}
.cj-card-brand .cj-hours,
.cj-card-brand .cj-hours th,
.cj-card-brand .cj-hours td {
	border-color: rgba(255, 255, 255, .35);
}
.cj-card-brand .cj-hours .cj-closed {
	color: #ffd0c7;
}
.cj-pill--dark {
	color: var(--global-palette9);
}

/* ---- Tip card: button pinned to the bottom of the card ---- */
.wp-block-kadence-column.cj-tip > .kt-inside-inner-col {
	display: flex;
	flex-direction: column;
	height: 100%;
}
.wp-block-kadence-column.cj-tip .wp-block-kadence-advancedbtn {
	margin-top: auto;
}

/* ---- Hours table: no rule above the first row ---- */
.cj-hours tr:first-child th,
.cj-hours tr:first-child td {
	border-top: 0;
}

/* ---- Top-3 design pass: hero crop, proof strip, photo band, advice on blue, card hover ---- */
.cj-hero__photo img {
	object-position: center 40%;
}
.cj-hero h1 mark {
	background: none !important;
	color: var(--global-palette9) !important;
	border-bottom: 6px solid var(--global-palette2) !important;
	padding: 0 0 2px !important;
}
.cj-proof .cj-stat + .cj-stat {
	border-left: 1px solid var(--global-palette6);
}
@media (max-width: 1024px) {
	.cj-proof .cj-stat:nth-child(odd) {
		border-left: 0;
	}
	.cj-proof .cj-stat {
		padding-left: 0 !important;
	}
	.cj-proof .cj-stat:nth-child(even) {
		padding-left: 20px !important;
	}
}
.cj-advice--on-blue .entry {
	background: var(--global-palette9);
	color: var(--global-palette4);
}
.cj-advice--on-blue .entry .entry-title a,
.cj-advice--on-blue .entry .entry-content,
.cj-advice--on-blue .entry .entry-summary {
	color: var(--global-palette3);
}
.cj-advice--on-blue .entry .entry-taxonomies a {
	background: var(--global-palette1);
	color: var(--global-palette9);
}
.cj-card .kt-blocks-info-box-learnmore::after {
	display: inline-block;
	transition: transform .25s cubic-bezier(.16, 1, .3, 1);
}
.cj-card:hover .kt-blocks-info-box-learnmore::after {
	transform: translateX(4px);
}

.cj-stat__figure {
	white-space: nowrap;
}

/* ---- Mobile header: smaller Book online button ---- */
#mobile-header .mobile-header-button-wrap .button,
#mobile-header .mobile-header-button {
	font-size: 14px !important;
	padding: 8px 14px !important;
	min-height: 0 !important;
	line-height: 1.3 !important;
	border-radius: 10px !important;
}

/* ======================================================================
   Design pass 4-8: motion, booking frame, status pulse, mobile layouts
   ====================================================================== */

/* ---- Motion: sections rise in as they enter; cards stagger. Scroll-driven, no JS. ---- */
@media (prefers-reduced-motion: no-preference) {
	@supports (animation-timeline: view()) {
		@keyframes cj-rise {
			from { opacity: 0; transform: translateY(24px); }
			to   { opacity: 1; transform: none; }
		}
		.entry-content > .wp-block-kadence-rowlayout:not(.cj-hero) {
			animation: cj-rise 0.7s cubic-bezier(.16, 1, .3, 1) both;
			animation-timeline: view();
			animation-range: entry 0% entry 28%;
		}
		.cj-card,
		.cj-stat {
			animation: cj-rise 0.6s cubic-bezier(.16, 1, .3, 1) both;
			animation-timeline: view();
			animation-range: entry 0% entry 35%;
		}
		.wp-block-kadence-column:nth-child(2) .cj-card { animation-range: entry 6% entry 41%; }
		.wp-block-kadence-column:nth-child(3) .cj-card { animation-range: entry 12% entry 47%; }
		.cj-stat:nth-child(2) { animation-range: entry 6% entry 41%; }
		.cj-stat:nth-child(3) { animation-range: entry 12% entry 47%; }
		.cj-stat:nth-child(4) { animation-range: entry 18% entry 53%; }
	}
	/* Button arrows nudge on hover */
	.kb-button .kb-svg-icon-wrap,
	.kb-button svg {
		transition: transform .25s cubic-bezier(.16, 1, .3, 1);
	}
	.kb-button:hover .kb-svg-icon-wrap,
	.kb-button:hover > svg {
		transform: translateX(3px);
	}
	/* Status dot pulses once on load */
	@keyframes cj-pulse {
		0%   { box-shadow: 0 0 0 0 rgba(69, 212, 131, .7); }
		100% { box-shadow: 0 0 0 10px rgba(69, 212, 131, 0); }
	}
	.cj-today::before {
		animation: cj-pulse 1.4s ease-out 0.6s 1;
	}
	.cj-today.is-closed::before {
		animation: none;
	}
}

/* ---- Booking card: tighter frame around the BookMyGarage widget ---- */
.cj-book-card iframe {
	display: block;
	border-radius: 12px;
}
.cj-book-card .cj-form-note {
	color: var(--global-palette5);
	font-size: 13px;
}

/* ---- Mobile: stat strip scrolls sideways; service cards go image-left ---- */
@media (max-width: 767px) {
	.cj-proof > .kt-row-column-wrap {
		display: flex !important;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		gap: 16px;
		padding-bottom: 8px;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}
	.cj-proof > .kt-row-column-wrap::-webkit-scrollbar {
		display: none;
	}
	.cj-proof .cj-stat {
		flex: 0 0 76%;
		scroll-snap-align: start;
		border-left: 0;
		padding: 0 !important;
	}
	/* Service cards stay stacked on mobile: photo on top, copy below. */
	.cj-card .kt-blocks-info-box-media img {
		aspect-ratio: 16 / 7;
		object-fit: cover;
	}
}

/* ---- 404 ---- */
.cj-404 {
	padding: 96px 24px 120px;
	max-width: 760px;
	margin: 0 auto;
}
.cj-404__title {
	font-size: clamp(2.5rem, 6vw, 4.5rem);
	line-height: 0.96;
	letter-spacing: -0.04em;
	margin: 20px 0 16px;
}
.cj-404__text {
	font-size: 19px;
	color: var(--global-palette4);
	max-width: 46ch;
	margin: 0 0 32px;
}
.cj-404__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}
.cj-404__btn--outline {
	background: transparent !important;
	color: var(--global-palette3) !important;
	border: 2px solid var(--global-palette3) !important;
}
.cj-404__btn--outline:hover {
	background: var(--global-palette3) !important;
	color: var(--global-palette9) !important;
}

/* Mobile stat scroller: no rules between items; booking iframe trimmed to the widget's height */
@media (max-width: 767px) {
	.cj-proof .cj-stat + .cj-stat {
		border-left: 0;
	}
}
.cj-book-card iframe {
	height: 220px !important;
	min-height: 220px !important;
}

/* ---- Mobile drawer: phone links white, out-of-hours coral, no underlines ---- */
.header-popup .mobile-html a,
#mobile-drawer .mobile-html a {
	color: var(--global-palette9);
	text-decoration: none;
	font-weight: 500;
	line-height: 1.9;
}
.header-popup .mobile-html a.cj-oo-hours,
#mobile-drawer .mobile-html a.cj-oo-hours {
	color: var(--global-palette2) !important;
}

/* ---- Advice cards: tighter on phones ---- */
@media (max-width: 767px) {
	.cj-advice .entry {
		padding: 22px 20px 24px;
	}
	.cj-advice .entry-title {
		font-size: 22px;
	}
}

/* Kadence Posts wraps the card contents in a second padded box; the card itself already has padding. */
.cj-advice .entry .entry-content-wrap {
	padding: 0;
}
.cj-advice .entry .entry-summary p:last-child {
	margin-bottom: 0;
}

/* ---- Footer: visible column headings; centred and compact on phones ---- */
.site-footer .footer-widget-area h3 {
	color: var(--global-palette9);
	font-size: 18px;
	margin: 0 0 8px;
}
.site-footer .footer-widget-area p {
	margin-bottom: 0;
}
@media (max-width: 767px) {
	.site-footer .site-top-footer-inner-wrap {
		gap: 28px;
	}
	.site-footer .footer-widget-area,
	.site-footer .footer-widget-area-inner,
	.site-footer .site-info,
	.site-footer .footer-html {
		text-align: center;
	}
	.site-footer .cj-footer-logo-wrap img {
		margin: 0 auto;
		width: 100px !important;
		height: auto;
		aspect-ratio: 1 / 1;
	}
	.site-footer .footer-navigation .footer-menu-container > ul {
		justify-content: center;
	}
	.site-footer .site-top-footer-wrap .site-footer-row-container-inner {
		padding-top: 40px;
		padding-bottom: 8px;
	}
}
@media (max-width: 767px) {
	.site-footer .site-middle-footer-wrap .site-footer-row-container-inner {
		padding-top: 8px;
		padding-bottom: 8px;
	}
	.site-footer .site-bottom-footer-wrap .site-footer-row-container-inner {
		padding-top: 4px;
		padding-bottom: 28px;
	}
	.site-footer .footer-html {
		margin: 0;
		font-size: 14px;
	}
}

/* ---- Mobile header logo: vertically centred, capped at 100px ---- */
@media (max-width: 1024px) {
	#mobile-header .brand img,
	.site-mobile-header-wrap .brand img {
		max-width: 100px;
		position: absolute;
		left: 0;
		top: 50%;
		transform: translateY(-50%);
	}
}

/* ---- Stat icons: no border on the blue tile ---- */
.cj-stat .kt-svg-style-stacked,
.cj-stat .kt-svg-icon-wrap {
	border: 0 !important;
}
.cj-stat .kb-svg-icon-wrap {
	border: 0 !important;
}
