/**
 * CalculatorPeak theme styles: site chrome and homepage.
 *
 * Depends on the plugin's cp-tokens.css for all colour and type values, so the
 * theme and the calculator pages are one visual system. A minimal fallback set
 * is declared first in case the plugin is ever deactivated.
 */

:root {
	--cp-navy: #102a43;
	--cp-blue: #2563eb;
	--cp-blue-hover: #1d4ed8;
	--cp-blue-light: #eff6ff;
	--cp-bg: #ffffff;
	--cp-bg-soft: #f8fafc;
	--cp-text: #0f172a;
	--cp-text-muted: #64748b;
	--cp-border: #e2e8f0;
	--cp-header-height: 72px;
}

/* Reset ------------------------------------------------------------------- */

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

body {
	margin: 0;
	background: var(--cp-bg);
	color: var(--cp-text);
	font-family: var(--cp-font-sans, system-ui, sans-serif);
	font-size: 16px;
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
}

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

a {
	color: var(--cp-blue);
}

.cp-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100;
	padding: var(--cp-space-3) var(--cp-space-4);
	background: var(--cp-navy);
	color: #fff;
	text-decoration: none;
}

.cp-skip-link:focus {
	left: var(--cp-space-4);
	top: var(--cp-space-4);
}

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

.cp-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: saturate(180%) blur(8px);
	border-bottom: 1px solid var(--cp-border);
}

.cp-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--cp-space-4);
	min-height: var(--cp-header-height);
}

/* Logo -------------------------------------------------------------------- */

.cp-logo {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	flex: 0 0 auto;
}

.cp-logo__peak-back {
	fill: var(--cp-navy);
}

.cp-logo__peak-front {
	fill: var(--cp-blue);
}

.cp-logo__text {
	display: flex;
	flex-direction: column;
	line-height: 1.1;
}

.cp-logo__word {
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--cp-navy);
}

.cp-logo__word-accent {
	color: var(--cp-blue);
}

.cp-logo__tagline {
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--cp-text-muted);
}

.cp-logo--footer .cp-logo__word,
.cp-logo--footer .cp-logo__word-accent {
	color: #fff;
}

.cp-logo--footer .cp-logo__peak-back {
	fill: #fff;
}

.cp-logo--footer .cp-logo__peak-front {
	fill: var(--cp-blue);
}

.cp-logo--footer .cp-logo__tagline {
	color: rgba(255, 255, 255, 0.6);
}

/* Navigation -------------------------------------------------------------- */

.cp-nav {
	display: flex;
	align-items: center;
	gap: var(--cp-space-5);
}

.cp-nav__list {
	display: flex;
	align-items: center;
	gap: var(--cp-space-5);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cp-nav__list a,
.cp-nav .menu-item a {
	display: block;
	padding: var(--cp-space-2) 0;
	font-size: 0.9375rem;
	font-weight: 500;
	color: var(--cp-text);
	text-decoration: none;
	transition: color 150ms ease;
}

.cp-nav__list a:hover,
.cp-nav .menu-item a:hover,
.cp-nav .current-menu-item > a {
	color: var(--cp-blue);
}

.cp-nav .sub-menu {
	position: absolute;
	min-width: 200px;
	margin-top: var(--cp-space-2);
	padding: var(--cp-space-2);
	list-style: none;
	background: #fff;
	border: 1px solid var(--cp-border);
	border-radius: var(--cp-radius, 10px);
	box-shadow: var(--cp-shadow-lg, 0 8px 24px rgba(15, 23, 42, 0.08));
	opacity: 0;
	visibility: hidden;
	transition: opacity 150ms ease;
}

.cp-nav .menu-item-has-children {
	position: relative;
}

.cp-nav .menu-item-has-children:hover > .sub-menu,
.cp-nav .menu-item-has-children:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
}

.cp-nav .sub-menu a {
	padding: var(--cp-space-2) var(--cp-space-3);
	border-radius: var(--cp-radius-sm, 6px);
}

.cp-nav .sub-menu a:hover {
	background: var(--cp-blue-light);
}

.cp-nav-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--cp-border);
	border-radius: var(--cp-radius, 10px);
	background: #fff;
	cursor: pointer;
}

.cp-nav-toggle__bars,
.cp-nav-toggle__bars::before,
.cp-nav-toggle__bars::after {
	display: block;
	width: 18px;
	height: 2px;
	background: var(--cp-navy);
	border-radius: 2px;
}

.cp-nav-toggle__bars {
	position: relative;
}

.cp-nav-toggle__bars::before,
.cp-nav-toggle__bars::after {
	content: "";
	position: absolute;
}

.cp-nav-toggle__bars::before {
	top: -6px;
}

.cp-nav-toggle__bars::after {
	top: 6px;
}

/* Search ------------------------------------------------------------------ */

.cp-search {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--cp-space-2);
	padding: 6px 6px 6px var(--cp-space-5);
	border: 1px solid var(--cp-border);
	border-radius: var(--cp-radius-pill, 999px);
	background: #fff;
	box-shadow: var(--cp-shadow, 0 2px 8px rgba(15, 23, 42, 0.06));
}

.cp-search__icon {
	flex: 0 0 auto;
	color: var(--cp-text-muted);
}

.cp-search__input {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	font-family: inherit;
	font-size: 16px;
	color: var(--cp-text);
}

.cp-search__input::placeholder {
	color: var(--cp-text-muted);
}

.cp-search__input:focus {
	outline: none;
}

.cp-search:focus-within {
	border-color: var(--cp-blue);
	box-shadow: 0 0 0 3px var(--cp-blue-light);
}

.cp-search__submit {
	flex: 0 0 auto;
	border-radius: var(--cp-radius-pill, 999px);
	min-height: 44px;
}

.cp-search--hero {
	max-width: 560px;
	margin-top: var(--cp-space-5);
}

/* Hero -------------------------------------------------------------------- */

.cp-hero {
	padding: var(--cp-space-8) 0;
	background: linear-gradient(180deg, var(--cp-blue-light) 0%, #ffffff 100%);
}

.cp-hero__inner {
	display: grid;
	grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
	gap: var(--cp-space-7);
	align-items: center;
}

.cp-eyebrow {
	margin: 0 0 var(--cp-space-3);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cp-blue);
}

.cp-hero__title {
	margin: 0 0 var(--cp-space-4);
	font-size: clamp(2rem, 5vw, 3rem);
	font-weight: 700;
	line-height: 1.12;
	letter-spacing: -0.03em;
	color: var(--cp-navy);
}

.cp-hero__title-accent {
	color: var(--cp-blue);
}

.cp-hero__text {
	margin: 0;
	max-width: 46ch;
	font-size: 1.0625rem;
	color: var(--cp-text-muted);
}

.cp-hero__suggestions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--cp-space-3);
	margin: var(--cp-space-4) 0 0;
	font-size: 0.875rem;
}

.cp-hero__suggestions-label {
	font-weight: 600;
	color: var(--cp-navy);
}

.cp-hero__suggestions a {
	color: var(--cp-blue);
	text-decoration: none;
}

.cp-hero__suggestions a:hover {
	text-decoration: underline;
}

.cp-stats {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cp-space-6);
	margin: var(--cp-space-6) 0 0;
	padding: 0;
	list-style: none;
}

.cp-stat {
	display: flex;
	flex-direction: column;
}

.cp-stat__value {
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--cp-navy);
}

.cp-stat__label {
	font-size: 0.8125rem;
	color: var(--cp-text-muted);
}

.cp-hero__panel,
.cp-panel {
	padding: var(--cp-space-5);
	border: 1px solid var(--cp-border);
	border-radius: var(--cp-radius-lg, 14px);
	background: #fff;
	box-shadow: var(--cp-shadow-lg, 0 8px 24px rgba(15, 23, 42, 0.08));
}

.cp-hero__panel-title,
.cp-panel__label {
	display: block;
	margin-bottom: var(--cp-space-3);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cp-text-muted);
}

.cp-ticks {
	display: grid;
	gap: var(--cp-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cp-ticks li {
	display: flex;
	align-items: flex-start;
	gap: var(--cp-space-2);
	font-size: 0.9375rem;
	color: var(--cp-text);
}

.cp-ticks li::before {
	content: "";
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin-top: 4px;
	background: var(--cp-blue);
	border-radius: 50%;
	clip-path: polygon(24% 52%, 12% 64%, 40% 88%, 88% 30%, 76% 20%, 40% 66%);
}

.cp-ticks--large li {
	font-size: 1rem;
	margin-bottom: var(--cp-space-1);
}

/* Sections ---------------------------------------------------------------- */

.cp-section {
	padding: var(--cp-space-8) 0;
}

.cp-section--soft {
	background: var(--cp-bg-soft);
}

.cp-section__header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--cp-space-4);
	margin-bottom: var(--cp-space-6);
}

.cp-section__title {
	margin: 0 0 var(--cp-space-2);
	font-size: clamp(1.5rem, 3vw, 1.875rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--cp-navy);
}

.cp-section__text {
	margin: 0;
	max-width: 56ch;
	color: var(--cp-text-muted);
}

/* Category grid ----------------------------------------------------------- */

.cp-category-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: var(--cp-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cp-category__link {
	display: flex;
	flex-direction: column;
	gap: 2px;
	height: 100%;
	padding: var(--cp-space-4);
	border: 1px solid var(--cp-border);
	border-radius: var(--cp-radius, 10px);
	background: #fff;
	text-decoration: none;
	transition: border-color 150ms ease, box-shadow 150ms ease;
}

.cp-category__link:hover {
	border-color: var(--cp-blue);
	box-shadow: var(--cp-shadow, 0 2px 8px rgba(15, 23, 42, 0.06));
}

.cp-category__name {
	font-weight: 600;
	color: var(--cp-navy);
}

.cp-category__count {
	font-size: 0.8125rem;
	color: var(--cp-text-muted);
}

/* Split section ----------------------------------------------------------- */

.cp-split {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
	gap: var(--cp-space-7);
	align-items: center;
}

.cp-panel__question {
	margin: 0 0 var(--cp-space-2);
	font-size: 1rem;
	color: var(--cp-text-muted);
}

.cp-panel__answer {
	margin: 0 0 var(--cp-space-4);
	font-size: 2.5rem;
	font-weight: 700;
	line-height: 1.1;
	color: var(--cp-blue);
}

.cp-panel__steps {
	margin: 0;
	padding-left: var(--cp-space-5);
	font-family: var(--cp-font-mono, monospace);
	font-size: 0.875rem;
	color: var(--cp-text);
}

/* CTA --------------------------------------------------------------------- */

.cp-section--cta {
	background: var(--cp-navy);
}

.cp-cta {
	text-align: center;
}

.cp-cta__title {
	margin: 0 0 var(--cp-space-2);
	font-size: clamp(1.5rem, 3vw, 1.875rem);
	font-weight: 700;
	color: #fff;
}

.cp-cta__text {
	margin: 0 0 var(--cp-space-5);
	color: rgba(255, 255, 255, 0.72);
}

.cp-cta__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--cp-space-3);
}

.cp-section--cta .cp-button--ghost {
	border-color: rgba(255, 255, 255, 0.3);
	color: #fff;
}

.cp-section--cta .cp-button--ghost:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: #fff;
}

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

.cp-footer {
	padding: var(--cp-space-8) 0 var(--cp-space-5);
	background: var(--cp-navy);
	color: rgba(255, 255, 255, 0.72);
}

.cp-footer__top {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
	gap: var(--cp-space-6);
}

.cp-footer__blurb {
	margin: var(--cp-space-4) 0 0;
	max-width: 34ch;
	font-size: 0.875rem;
	line-height: 1.6;
}

.cp-footer__heading {
	margin: 0 0 var(--cp-space-3);
	font-size: 0.875rem;
	font-weight: 700;
	color: #fff;
}

.cp-footer__list {
	display: grid;
	gap: var(--cp-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
}

.cp-footer__list a {
	color: rgba(255, 255, 255, 0.72);
	text-decoration: none;
}

.cp-footer__list a:hover {
	color: #fff;
	text-decoration: underline;
}

.cp-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--cp-space-3);
	margin-top: var(--cp-space-7);
	padding-top: var(--cp-space-5);
	border-top: 1px solid rgba(255, 255, 255, 0.12);
	font-size: 0.8125rem;
}

.cp-footer__copy,
.cp-footer__note {
	margin: 0;
}

/* Pagination -------------------------------------------------------------- */

.cp-pagination {
	margin-top: var(--cp-space-6);
}

.cp-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 var(--cp-space-3);
	border: 1px solid var(--cp-border);
	border-radius: var(--cp-radius, 10px);
	margin-right: var(--cp-space-2);
	text-decoration: none;
	color: var(--cp-text);
}

.cp-pagination .page-numbers.current {
	background: var(--cp-blue);
	border-color: var(--cp-blue);
	color: #fff;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1000px) {

	.cp-hero__inner,
	.cp-split {
		grid-template-columns: 1fr;
	}

	.cp-hero__aside {
		display: none;
	}

	.cp-footer__top {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 900px) {

	.cp-nav-toggle {
		display: inline-flex;
	}

	.cp-nav {
		position: absolute;
		left: 0;
		right: 0;
		top: 100%;
		flex-direction: column;
		align-items: stretch;
		gap: var(--cp-space-3);
		padding: var(--cp-space-4) var(--cp-gutter, 16px);
		background: #fff;
		border-bottom: 1px solid var(--cp-border);
		box-shadow: var(--cp-shadow-lg, 0 8px 24px rgba(15, 23, 42, 0.08));
	}

	/* Without JS the menu simply stays open rather than becoming unreachable. */
	.cp-has-js .cp-nav {
		display: none;
	}

	.cp-has-js .cp-nav--open {
		display: flex;
	}

	.cp-nav__list {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.cp-nav__list li {
		border-bottom: 1px solid var(--cp-border);
	}

	.cp-nav__list a {
		padding: var(--cp-space-3) 0;
	}

	.cp-nav .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		box-shadow: none;
		border: 0;
		padding-left: var(--cp-space-4);
	}
}

@media (max-width: 600px) {

	.cp-hero {
		padding: var(--cp-space-6) 0;
	}

	.cp-section {
		padding: var(--cp-space-7) 0;
	}

	.cp-stats {
		gap: var(--cp-space-5);
	}

	.cp-search {
		flex-wrap: wrap;
		border-radius: var(--cp-radius-lg, 14px);
		padding: var(--cp-space-3);
	}

	.cp-search__submit {
		width: 100%;
	}

	.cp-footer__top {
		grid-template-columns: 1fr;
		gap: var(--cp-space-5);
	}

	.cp-logo__tagline {
		display: none;
	}
}
