/*
 * Homepage [ch_home] + Ask Carhacker chat [ch_ai_chat]
 * Colors come from design-system.css tokens (--chmem-*), with fallbacks.
 */

/* ---------- GeneratePress shell on the homepage ---------- */
body.ch-home-page{overflow-x:clip}
body.ch-home-page .entry-header,
body.ch-home-page .page-header-image{display:none}
body.ch-home-page .site-main{margin:0 !important}
body.ch-home-page .inside-article{padding:0 !important;background:transparent}
body.ch-home-page .entry-content{margin:0 !important}
body.ch-home-page .site-content{padding:0 !important}
body.ch-home-page.separate-containers .site-main > *{margin-bottom:0}

.ch-home{
	--h-ink:var(--chmem-ink,#14171c);
	--h-body:var(--chmem-body,#54606e);
	--h-line:var(--chmem-line,#e2e5e9);
	--h-soft:var(--chmem-bg-soft,#f4f5f7);
	--h-primary:var(--chmem-primary,#1e3a8a);
	--h-primary-d:var(--chmem-primary-dark,#1e40af);
	--h-r:var(--chmem-r,6px);
	color:var(--h-ink);
	font-size:16px;
}
.ch-home *,.ch-home *::before,.ch-home *::after{box-sizing:border-box}
.ch-home a{text-decoration:none}
.ch-home h2,.ch-home h3,.ch-home p{margin:0}

/* full-bleed bands inside a boxed content area */
.ch-home-band{background:#fff;width:100vw;margin-left:calc(50% - 50vw);margin-right:calc(50% - 50vw)}
.ch-home-in{max-width:1100px;margin:0 auto;padding:0 24px}
.ch-home-in--narrow{max-width:980px}

.ch-home-sec{padding:56px 0}
.ch-home-sec--tight{padding-top:0}

.ch-home-go{color:var(--h-primary);font-weight:700;font-size:14.5px}
.ch-home-go span{display:inline-block;transition:transform .15s}

/* ---------- hero ---------- */
.ch-home-hero{background:linear-gradient(180deg,#f3f6fc 0%,#fff 100%);border-bottom:1px solid var(--h-line);padding:64px 0 52px}

/* ---------- chat ---------- */
.ch-chat-wrap{
	--c-ink:var(--chmem-ink,#14171c);
	--c-body:var(--chmem-body,#54606e);
	--c-line:var(--chmem-line,#e2e5e9);
	--c-soft:var(--chmem-bg-soft,#f4f5f7);
	--c-primary:var(--chmem-primary,#1e3a8a);
	--c-primary-d:var(--chmem-primary-dark,#1e40af);
	--c-r:var(--chmem-r,6px);
	max-width:760px;margin:0 auto;color:var(--c-ink);
}
.ch-chat-wrap *{box-sizing:border-box}
.ch-home-chat-solo{padding:40px 0}

.ch-chat-header{text-align:center;margin-bottom:28px}
.ch-chat-wrap .ch-chat-title{font-size:46px;line-height:1.1;letter-spacing:-.025em;margin:18px 0 14px;font-weight:800;color:var(--c-ink);text-wrap:balance}
.ch-chat-wrap .ch-chat-lead{font-size:18px;color:var(--c-body);line-height:1.55;margin:0 auto;max-width:620px}

.ch-input-row{display:flex;gap:8px;background:#fff;border:1px solid #cfd6e2;border-radius:10px;padding:8px;transition:border-color .15s,box-shadow .15s}
.ch-input-row:focus-within{border-color:var(--c-primary);box-shadow:0 0 0 3px rgba(30,58,138,.12)}
.ch-chat-wrap .ch-input{flex:1;min-width:0;border:0 !important;outline:none;background:transparent !important;box-shadow:none !important;padding:14px 12px;font-size:17px;font-family:inherit;color:var(--c-ink);margin:0}
.ch-chat-wrap .ch-send-btn{background:var(--c-primary) !important;text-transform:none;letter-spacing:0;box-shadow:none;color:#fff !important;border:0;border-radius:7px;padding:0 26px;font-size:16px;font-weight:700;font-family:inherit;cursor:pointer;transition:background .15s;line-height:1}
.ch-chat-wrap .ch-send-btn:hover{background:var(--c-primary-d) !important}
.ch-chat-wrap .ch-send-btn:disabled{opacity:.45;cursor:not-allowed}


.ch-chat-panel{text-align:left}
.ch-chat-panel .ch-input-row:focus-within{border-color:var(--c-primary)}

.ch-chat-stats{display:flex;flex-wrap:wrap;justify-content:center;gap:10px 36px;margin-top:30px;font-size:15px;color:var(--c-body)}
.ch-chat-stats span{display:flex;flex-direction:column;align-items:center;line-height:1.3}
.ch-chat-stats b{color:var(--c-primary);font-size:30px;font-weight:800;letter-spacing:-.02em;line-height:1.1}

.ch-affiliate-note{font-size:12px;color:#8a94a1;margin:12px 0 0;text-align:center}

/* conversation */
.ch-messages{display:none;flex-direction:column;gap:18px;margin:0 0 20px;text-align:left}
.ch-chat-wrap.is-chatting .ch-messages{display:flex}
.ch-chat-wrap.is-chatting .ch-chat-header{margin-bottom:24px}

.ch-msg-user{align-self:flex-end;max-width:80%;background:var(--c-primary);color:#fff;padding:11px 16px;border-radius:14px 14px 4px 14px;font-size:15px;line-height:1.5;overflow-wrap:anywhere}
.ch-msg-bot{align-self:flex-start;width:100%;background:#fff;border:1px solid var(--c-line);border-radius:4px 14px 14px 14px;padding:20px}
.ch-msg-bot.loading{display:flex;align-items:center;gap:12px;color:var(--c-body);font-size:14px;padding:16px 20px}
.ch-spinner{width:18px;height:18px;border:2px solid var(--c-line);border-top-color:var(--c-primary);border-radius:50%;animation:ch-spin .7s linear infinite;flex:none}
@keyframes ch-spin{to{transform:rotate(360deg)}}

.ch-answer{font-size:15.5px;line-height:1.65;color:var(--c-ink)}
.ch-answer strong{font-weight:700}
.ch-answer p{margin:0 0 12px}
.ch-answer p:last-child{margin-bottom:0}
.ch-answer a.ch-inline-link{color:var(--c-primary) !important;text-decoration:underline;text-underline-offset:2px;font-weight:600}
.ch-answer a.ch-inline-link:hover{color:var(--c-primary-d) !important}
.ch-answer--error{color:#b91c1c}

.ch-products{display:flex;flex-direction:column;gap:12px;margin-top:20px}
.ch-product-card{display:flex;gap:16px;background:#fff;border:1px solid var(--c-line);border-radius:var(--c-r);padding:14px;transition:border-color .15s}
.ch-product-card:hover{border-color:#b9c3d3}
.ch-product-card.ch-featured-article{background:var(--c-soft)}
.ch-featured-cta-label{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--chmem-accent,#ea580c);font-weight:700;margin-bottom:6px}
.ch-product-img{width:96px;height:96px;flex-shrink:0;background:var(--c-soft);border-radius:var(--c-r);object-fit:contain;border:1px solid var(--c-line)}
.ch-product-info{flex:1;min-width:0}
.ch-chat-wrap .ch-product-name{font-size:16px;font-weight:700;color:var(--c-ink);margin:0 0 4px;line-height:1.3}
.ch-product-meta{font-size:13px;color:var(--c-body);margin-bottom:8px}
.ch-product-meta .ch-score{color:#15803d;font-weight:700}
.ch-product-meta .ch-price-approx{color:#8a94a1;font-style:italic}
.ch-product-verdict{font-size:13.5px;color:#3d4753;line-height:1.45;margin-bottom:12px}
.ch-product-actions{display:flex;gap:8px;flex-wrap:wrap}

.ch-chat-wrap .ch-btn-primary,
.ch-chat-wrap .ch-btn-secondary{display:inline-flex;align-items:center;gap:6px;padding:8px 14px;border-radius:var(--c-r);font-size:13.5px;font-weight:700;text-decoration:none;border:1px solid transparent;transition:background .15s,border-color .15s,color .15s;line-height:1.3}
.ch-chat-wrap .ch-btn-primary{background:var(--chmem-accent,#ea580c);border-color:var(--chmem-accent,#ea580c);color:#fff !important}
.ch-chat-wrap .ch-btn-primary:hover{background:#c2410c;border-color:#c2410c}
.ch-chat-wrap .ch-btn-secondary{background:#fff;border-color:var(--c-primary);color:var(--c-primary) !important}
.ch-chat-wrap .ch-btn-secondary:hover{background:var(--c-primary);color:#fff !important}

.ch-sources{margin-top:18px;padding-top:14px;border-top:1px solid var(--c-line)}
.ch-sources-label{font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:#8a94a1;font-weight:700;margin-bottom:8px}
.ch-chat-wrap .ch-sources-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.ch-chat-wrap .ch-sources-list li{margin:0}
.ch-chat-wrap .ch-sources-list a{color:var(--c-primary) !important;font-size:14px;font-weight:600;text-decoration:none}
.ch-chat-wrap .ch-sources-list a:hover{text-decoration:underline}

/* ---------- path cards ---------- */
.ch-home-paths{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}
.ch-home-path{position:relative;border:1px solid var(--h-line);border-radius:var(--h-r);padding:24px;display:flex;flex-direction:column;gap:8px;background:#fff;color:var(--h-ink);transition:border-color .15s,box-shadow .15s}
.ch-home-path:hover{border-color:#b9c3d3;box-shadow:0 4px 14px rgba(20,23,28,.06)}
.ch-home-path:hover .ch-home-go span{transform:translateX(3px)}
.ch-home-path__ic{width:42px;height:42px;border-radius:8px;background:#e6ecf8;color:var(--h-primary);display:flex;align-items:center;justify-content:center;margin-bottom:6px}
.ch-home .ch-home-path__t{font-size:19px;line-height:1.3;font-weight:700;color:inherit}
.ch-home-path p{color:var(--h-body);font-size:15px;line-height:1.5;flex:1}
.ch-home-path .ch-home-go{margin-top:8px}
.ch-home-tag{position:absolute;top:24px;right:24px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;background:#fde7d9;color:#9a3412;padding:3px 8px;border-radius:4px}

/* ---------- section head ---------- */
.ch-home-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;margin-bottom:22px}
.ch-home .ch-home-head h2{font-size:26px;line-height:1.25;letter-spacing:-.015em;font-weight:800;color:var(--h-ink);margin:0 0 6px}
.ch-home-head p{color:var(--h-body);font-size:16px}
.ch-home-head a{color:var(--h-primary);font-weight:700;font-size:15px;white-space:nowrap}
.ch-home-head a:hover{text-decoration:underline}

/* ---------- guide tiles ---------- */
.ch-home-guides{display:grid;grid-template-columns:repeat(6,1fr);gap:14px}
.ch-home-guide{border:1px solid var(--h-line);border-radius:var(--h-r);padding:16px 10px 14px;text-align:center;background:#fff;color:var(--h-ink);display:flex;flex-direction:column;align-items:center;gap:10px;transition:border-color .15s,box-shadow .15s}
.ch-home-guide:hover{border-color:var(--h-primary);box-shadow:0 4px 14px rgba(20,23,28,.06)}
.ch-home-guide__img{height:56px;display:flex;align-items:center;justify-content:center}
.ch-home-guide__img img{max-height:56px;width:auto;max-width:100%;display:block;mix-blend-mode:multiply}
.ch-home-guide__t{font-size:13.5px;font-weight:700;line-height:1.3}
.ch-home-admin-note{background:#fffbeb;border:1px solid #f5dc9b;color:#92400e;border-radius:var(--h-r);padding:12px 14px;font-size:14px}
.ch-home-admin-note a{color:inherit;text-decoration:underline}

/* ---------- latest reviews ---------- */
.ch-home-reviews{display:grid;grid-template-columns:repeat(3,1fr);gap:22px}
.ch-home-card{position:relative;border:1px solid var(--h-line);border-radius:var(--h-r);overflow:hidden;background:#fff;display:flex;flex-direction:column;transition:border-color .15s,box-shadow .15s}
.ch-home-card:hover{border-color:#b9c3d3;box-shadow:0 4px 14px rgba(20,23,28,.06)}
.ch-home-card__img{aspect-ratio:16/9;overflow:hidden;background:var(--h-soft)}
.ch-home-card__img img{width:100%;height:100% !important;max-width:none;object-fit:cover;display:block;transition:transform .3s}
.ch-home-card:hover .ch-home-card__img img{transform:scale(1.03)}
.ch-home-card__b{padding:16px 18px 18px;display:flex;flex-direction:column;flex:1}
.ch-home-card__date{font-size:12px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:#7a8594;margin-bottom:6px}
.ch-home .ch-home-card__t{font-size:17px;line-height:1.35;font-weight:700;margin:0 0 12px;flex:1}
.ch-home-card__t a{color:var(--h-ink)}
.ch-home-card__t a::after{content:"";position:absolute;inset:0}
.ch-home-card:hover .ch-home-go span{transform:translateX(3px)}

/* ---------- about ---------- */
.ch-home-about{background:var(--h-soft);border-top:1px solid var(--h-line);padding:56px 0}
.ch-home-about .ch-home-in{display:grid;grid-template-columns:260px 1fr;gap:36px;align-items:center}
.ch-home-about .ch-home-about--noimg{grid-template-columns:1fr;max-width:760px}
.ch-home-about__img{width:100%;height:auto;aspect-ratio:1/1;object-fit:cover;border-radius:var(--h-r);border:1px solid var(--h-line);display:block}
.ch-home .ch-home-about__sig{font-size:20px;font-weight:800;color:var(--h-ink);margin:0 0 8px}
.ch-home-about__txt p{font-size:17px;line-height:1.6;color:var(--h-body);margin:0 0 18px}
.ch-home-about__btns{display:flex;flex-wrap:wrap;gap:10px}
.ch-home-btn{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--h-primary);color:var(--h-primary) !important;border-radius:var(--h-r);padding:10px 18px;font-weight:700;font-size:14.5px;background:#fff;transition:background .15s,color .15s}
.ch-home-btn:hover{background:var(--h-primary);color:#fff !important}
.ch-home-btn--yt{border-color:#dc2626;color:#dc2626 !important}
.ch-home-btn--yt:hover{background:#dc2626;color:#fff !important}

/* ---------- responsive ---------- */
@media (max-width:1000px){
	.ch-home-guides{grid-template-columns:repeat(3,1fr)}
}
@media (max-width:760px){
	.ch-home-in{padding:0 16px}
	.ch-home-hero{padding:36px 0 32px}
	.ch-chat-wrap .ch-chat-title{font-size:31px;margin:14px 0 10px}
	.ch-chat-wrap .ch-chat-lead{font-size:16px}
	.ch-chat-header{margin-bottom:22px}
	.ch-chat-wrap .ch-input{font-size:16px;padding:12px 8px}
	.ch-chat-wrap .ch-send-btn{padding:0 14px;font-size:14px}
	.ch-chat-stats{font-size:13px;gap:10px 22px}
	.ch-chat-stats b{font-size:24px}
	.ch-msg-bot{padding:16px}
	.ch-product-card{flex-direction:column}
	.ch-product-img{width:100%;height:170px}
	.ch-home-sec{padding:40px 0}
	.ch-home-sec--tight{padding-top:0}
	.ch-home-paths,.ch-home-reviews{grid-template-columns:1fr;gap:14px}
	.ch-home-guides{grid-template-columns:repeat(2,1fr);gap:10px}
	.ch-home-head{flex-direction:column;align-items:flex-start;gap:6px}
	.ch-home .ch-home-head h2{font-size:23px}
	.ch-home-about{padding:40px 0}
	.ch-home-about .ch-home-in{grid-template-columns:1fr;gap:20px}
	.ch-home-about__img{aspect-ratio:16/10}
}

/* messages inside the AI panel */
.ch-chat-panel .ch-msg-bot{background:#fff}
.ch-chat-wrap .ch-chat-lead{max-width:700px}
.ch-chat-wrap .ch-input:focus,.ch-chat-wrap .ch-input:focus-visible{outline:none !important;box-shadow:none !important}

/* lead + hallucination note */
.ch-chat-wrap .ch-chat-title{margin-top:0}
.ch-chat-wrap .ch-chat-fallback{font-size:14.5px;color:#7a8594;line-height:1.5;margin:8px auto 0;max-width:640px}
.ch-chat-fallback a{color:var(--c-primary) !important;font-weight:600;text-decoration:underline;text-underline-offset:2px}
.ch-chat-panel .ch-input-row{border-width:1px;border-color:#cfd6e2;box-shadow:0 6px 20px rgba(30,58,138,.07)}
.ch-home-tag{top:22px;right:22px}
.ch-chat-wrap .ch-affiliate-note{margin-top:16px}

/* theme link colors must not recolor card titles */
.ch-home a.ch-home-path,.ch-home .ch-home-path .ch-home-path__t{color:var(--h-ink) !important}
.ch-home .ch-home-card__t a{color:var(--h-ink) !important}
.ch-home .ch-home-card:hover .ch-home-card__t a{color:var(--h-primary) !important}
.ch-chat-wrap .ch-chat-fallback{margin-top:4px}
