/*
Theme Name:   ChainMaths
Theme URI:    https://chainmaths.com/
Description:  Dark, fast child theme for ChainMaths — built on Kadence. Custom header, footer, typography and colour system.
Author:       ChainMaths
Template:     kadence
Version:      1.0.3
Requires PHP: 7.4
License:      GPL-2.0-or-later
Text Domain:  chainmaths
*/

/* ---------- Kadence palette → ChainMaths dark system ---------- */
:root, body {
	--global-palette1: #c6f432;
	--global-palette2: #a8db12;
	--global-palette3: #e8edf5;
	--global-palette4: #d3dae6;
	--global-palette5: #98a3b8;
	--global-palette6: #667189;
	--global-palette7: #222b3b;
	--global-palette8: #0a0d13;
	--global-palette9: #121824;
	--global-palette-highlight: #c6f432;
	--global-palette-highlight-alt: #a8db12;
	--global-palette-btn-bg: #c6f432;
	--global-palette-btn-bg-hover: #d6ff5a;
	--global-palette-btn: #0a0d13;
	--global-palette-btn-hover: #0a0d13;
	--global-body-font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--global-heading-font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
}

html { background: #0a0d13; color-scheme: dark; }
body {
	background: #0a0d13 !important;
	color: #d3dae6;
	font-family: var(--global-body-font-family);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}
::selection { background: rgba(198, 244, 50, .28); color: #fff; }
h1, h2, h3, h4, h5, h6 { font-family: var(--global-heading-font-family); color: #e8edf5; letter-spacing: -.02em; }
a { color: #c6f432; }
a:hover { color: #d6ff5a; }
:focus-visible { outline: 2px solid #c6f432; outline-offset: 2px; }

/* Skip link */
.cm-skip { position: absolute; left: -9999px; top: 8px; z-index: 1000; padding: 10px 14px; border-radius: 10px; background: #c6f432; color: #0a0d13; font-weight: 700; }
.cm-skip:focus { left: 12px; }

/* ---------- Header ---------- */
.cm-header {
	position: sticky; top: 0; z-index: 100;
	background: rgba(10, 13, 19, .78);
	backdrop-filter: saturate(160%) blur(14px);
	-webkit-backdrop-filter: saturate(160%) blur(14px);
	border-bottom: 1px solid #1b2230;
}
/* Kadence styles #masthead (white background, position: relative); beat it with the id. */
#masthead.cm-header { position: sticky !important; top: 0; background: rgba(10, 13, 19, .82) !important; box-shadow: none; }
.admin-bar #masthead.cm-header { top: 32px; }
@media (max-width: 782px) { .admin-bar #masthead.cm-header { top: 0; position: relative !important; } }
#wrapper.site { background: #0a0d13; }
.cm-header-inner { max-width: 1180px; height: 68px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; }
.cm-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none !important; color: #e8edf5 !important; flex: none; }
.cm-logo svg { width: 30px; height: 30px; display: block; }
.cm-logo-text { font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif; font-weight: 700; font-size: 20px; letter-spacing: -.03em; }
.cm-logo-text b { color: #c6f432; font-weight: 700; }

.cm-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.cm-nav > a, .cm-dd > summary {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 8px 12px; border-radius: 9px;
	color: #b6c0d1 !important; text-decoration: none !important;
	font-size: 14.5px; font-weight: 600; cursor: pointer; list-style: none;
	transition: color .15s, background .15s;
}
.cm-nav > a:hover, .cm-dd > summary:hover, .cm-dd[open] > summary { color: #fff !important; background: rgba(255,255,255,.05); }
.cm-nav > a[aria-current="page"] { color: #c6f432 !important; }
.cm-dd { position: relative; }
.cm-dd > summary::-webkit-details-marker { display: none; }
.cm-dd > summary::after { content: ""; width: 6px; height: 6px; margin-left: 2px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.cm-mega {
	position: absolute; left: -12px; top: calc(100% + 12px);
	display: grid; grid-template-columns: repeat(3, 230px); gap: 8px;
	padding: 14px; border-radius: 16px;
	background: #10151f; border: 1px solid #263044;
	box-shadow: 0 30px 70px -20px rgba(0,0,0,.75);
}
.cm-mega-col h4 { margin: 6px 10px 8px; font: 600 11px/1.2 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; color: #667189; }
.cm-mega-col a { display: block; padding: 8px 10px; border-radius: 9px; color: #d3dae6 !important; text-decoration: none !important; font-size: 14px; }
.cm-mega-col a:hover { background: rgba(198,244,50,.08); color: #c6f432 !important; }
.cm-mega-foot { grid-column: 1 / -1; margin-top: 4px; padding: 10px 10px 2px; border-top: 1px solid #1f2736; }
.cm-mega-foot a { color: #c6f432 !important; font-weight: 600; font-size: 13.5px; text-decoration: none !important; }

.cm-cta {
	flex: none; display: inline-flex; align-items: center; gap: 8px;
	padding: 9px 16px; border-radius: 10px;
	background: #c6f432; color: #0a0d13 !important; text-decoration: none !important;
	font-weight: 700; font-size: 14px;
	box-shadow: 0 0 0 0 rgba(198,244,50,.0), inset 0 -2px 0 rgba(0,0,0,.15);
	transition: transform .15s, box-shadow .2s;
}
.cm-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 24px -8px rgba(198,244,50,.55), inset 0 -2px 0 rgba(0,0,0,.15); color: #0a0d13 !important; }

.cm-mnav { display: none; margin-left: auto; }
.cm-mnav > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid #263044; color: #e8edf5; }
.cm-mnav > summary::-webkit-details-marker { display: none; }
.cm-mnav > summary svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
.cm-mnav-panel { position: absolute; left: 0; right: 0; top: 68px; max-height: calc(100vh - 68px); overflow-y: auto; padding: 8px 20px 24px; background: #0d1119; border-bottom: 1px solid #1f2736; }
.cm-mnav-panel h4 { margin: 18px 0 6px; font: 600 11px "JetBrains Mono", ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; color: #667189; }
.cm-mnav-panel a { display: block; padding: 10px 0; border-bottom: 1px solid #161d29; color: #d3dae6 !important; text-decoration: none !important; font-size: 15.5px; }

@media (max-width: 960px) {
	.cm-nav, .cm-cta { display: none; }
	.cm-mnav { display: block; }
	.cm-header-inner { padding: 0 16px; height: 62px; }
	.cm-mnav-panel { top: 62px; }
}

/* ---------- Kadence layout resets on app pages ---------- */
.cm-app-page .content-area { margin-top: 0 !important; margin-bottom: 0 !important; }
.cm-app-page .site-container, .cm-app-page .content-container { max-width: none !important; padding-left: 0 !important; padding-right: 0 !important; }
.cm-app-page .entry-hero, .cm-app-page .entry-header, .cm-app-page .page-title, .cm-app-page .entry-hero-container-inner { display: none !important; }
.cm-app-page .entry, .cm-app-page .content-bg, .cm-app-page article.entry { background: transparent !important; box-shadow: none !important; border-radius: 0 !important; border: 0 !important; }
.cm-app-page .entry-content-wrap { padding: 0 !important; }
.cm-app-page .entry-content { margin: 0 !important; }
.cm-app-page .entry-content > .cm-full { max-width: none; }
.cm-app-page #primary { margin: 0 !important; }

/* ---------- Regular pages and posts ---------- */
body.page:not(.cm-app-page) .content-container, body.single-post .content-container { max-width: 880px; }
.content-bg, body.content-style-boxed .content-bg, .entry.content-bg { background: #121824; }
.entry { border: 1px solid #1d2533; border-radius: 18px !important; box-shadow: none !important; }
.entry-content { color: #c9d1de; font-size: 17px; line-height: 1.72; }
.entry-content h2 { font-size: clamp(24px, 2.6vw, 30px); margin-top: 1.8em; }
.entry-content h3 { font-size: 20px; }
.entry-content a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.entry-content li::marker { color: #c6f432; }
.entry-content strong { color: #e8edf5; }
.entry-content blockquote { border-left: 3px solid #c6f432; background: #161d2a; padding: 14px 18px; border-radius: 0 12px 12px 0; color: #d3dae6; }
.entry-content code { font-family: "JetBrains Mono", ui-monospace, monospace; background: #1a2230; padding: 2px 6px; border-radius: 6px; font-size: .88em; }
.entry-content pre { background: #0d1119; border: 1px solid #222b3b; border-radius: 12px; padding: 16px 18px; }
.entry-content table { border-collapse: collapse; width: 100%; }
.entry-content th, .entry-content td { border: 1px solid #222b3b; padding: 10px 12px; }
.entry-content th { background: #171f2d; color: #e8edf5; }
.entry-title, .page-title { color: #e8edf5; letter-spacing: -.03em; }
.entry-hero .entry-header, .entry-hero-container-inner { background: transparent; }
.entry-meta, .entry-meta a { color: #8590a6 !important; }
.wp-block-button__link, .button, button.button, input[type="submit"] { border-radius: 10px; font-weight: 700; }
input[type="text"], input[type="email"], input[type="search"], input[type="url"], textarea, select {
	background: #0d1119; border: 1px solid #2e394c; color: #e8edf5; border-radius: 10px;
}
.loop-entry .entry-title a { color: #e8edf5; }
.loop-entry .entry-title a:hover { color: #c6f432; }
.post-thumbnail { border-radius: 14px; overflow: hidden; }
hr, .wp-block-separator { border-color: #222b3b; }

/* ---------- Post thumbnails: our images are 1200×630 (1.9:1), so match that shape
   instead of Kadence's 3:2 crop, which cut off the edges. ---------- */
.post-thumbnail[class*="kadence-thumbnail-ratio"] { padding-bottom: 52.5% !important; }
.post-thumbnail img { object-fit: cover; object-position: center; }
.loop-entry .post-thumbnail { border-radius: 14px 14px 0 0; }

/* ---------- Phones ---------- */
@media (max-width: 600px) {
	.content-container.site-container { padding-left: 12px; padding-right: 12px; }
	.entry-content-wrap { padding: 24px 18px !important; }
	.entry-header .entry-title, .entry-hero .entry-title { font-size: 30px !important; line-height: 1.2 !important; }
	.loop-entry .entry-title { font-size: 22px !important; line-height: 1.25 !important; }
	.entry-content { font-size: 16.5px; }
	.entry-content h2 { font-size: 23px; }
	.entry-content h3 { font-size: 18.5px; }
	.entry-content table { display: block; overflow-x: auto; white-space: nowrap; }
	.entry-content pre { white-space: pre; overflow-x: auto; font-size: 13px; }
	body.blog .page-title, body.archive .page-title { font-size: 34px; }
}

/* ---------- Footer ---------- */
.cm-footer { margin-top: 0; border-top: 1px solid #1b2230; background: #080b10; color: #98a3b8; font-size: 14.5px; }
.cm-footer-inner { max-width: 1180px; margin: 0 auto; padding: 64px 24px 28px; }
.cm-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 40px; }
.cm-footer p { margin: 14px 0 0; line-height: 1.6; max-width: 320px; }
.cm-footer h4 { margin: 0 0 14px; font: 600 11.5px "JetBrains Mono", ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; color: #667189; }
.cm-footer ul { list-style: none; margin: 0; padding: 0; }
.cm-footer li { margin: 0 0 9px; }
.cm-footer li a { color: #b6c0d1 !important; text-decoration: none !important; }
.cm-footer li a:hover { color: #c6f432 !important; }
.cm-footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 48px; padding-top: 22px; border-top: 1px solid #161d29; font-size: 13px; color: #667189; }
.cm-footer-bottom span:last-child { font-family: "JetBrains Mono", ui-monospace, monospace; }
@media (max-width: 860px) {
	.cm-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
	.cm-footer-brand { grid-column: 1 / -1; }
}
