/*
 * site.css — the design foundation, loaded on every page the plugin owns.
 * Holds the design tokens (light + dark), base typography, the sticky
 * site header, the footer, buttons, and form controls. home.css and
 * calculator.css build on the tokens defined here.
 *
 * Palette: a clean slate neutral scale (slightly blue-biased, so it reads
 * as chosen rather than default grey) with an indigo primary and an
 * emerald "money/positive" accent — modern fintech, not decorative.
 */

:root {
	--ics-bg: #ffffff;
	--ics-surface: #ffffff;
	--ics-surface-2: #f8fafc;
	--ics-surface-3: #f1f5f9;
	--ics-ink: #0f172a;
	--ics-ink-2: #334155;
	--ics-muted: #64748b;
	--ics-border: #e7ebf0;
	--ics-border-2: #cbd5e1;
	--ics-primary: #4f46e5;
	--ics-primary-hover: #4338ca;
	--ics-primary-contrast: #ffffff;
	--ics-primary-soft: #eef2ff;
	--ics-success: #059669;
	--ics-success-soft: #ecfdf5;
	--ics-warning: #b45309;
	--ics-warning-soft: #fffbeb;
	--ics-danger: #dc2626;

	--ics-r-sm: 8px;
	--ics-r: 12px;
	--ics-r-lg: 16px;
	--ics-r-xl: 22px;
	--ics-r-pill: 999px;

	--ics-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
	--ics-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
	--ics-shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.14);
	--ics-ring: 0 0 0 3px rgba(79, 70, 229, 0.28);

	--ics-header-h: 68px;
	--ics-maxw: 1140px;

	--ics-font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
	--ics-mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", monospace;
}

:root[data-ics-theme="dark"] {
	--ics-bg: #0b1120;
	--ics-surface: #111a2e;
	--ics-surface-2: #0f172a;
	--ics-surface-3: #1e293b;
	--ics-ink: #f1f5f9;
	--ics-ink-2: #cbd5e1;
	--ics-muted: #94a3b8;
	--ics-border: #23304a;
	--ics-border-2: #334155;
	--ics-primary: #818cf8;
	--ics-primary-hover: #a5b4fc;
	--ics-primary-contrast: #0b1120;
	--ics-primary-soft: #1e214a;
	--ics-success: #34d399;
	--ics-success-soft: #0c2b23;
	--ics-warning: #fbbf24;
	--ics-warning-soft: #2a2410;
	--ics-danger: #f87171;

	--ics-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
	--ics-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
	--ics-shadow-lg: 0 20px 44px rgba(0, 0, 0, 0.55);
	--ics-ring: 0 0 0 3px rgba(129, 140, 248, 0.4);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-ics-theme="light"]) {
		--ics-bg: #0b1120;
		--ics-surface: #111a2e;
		--ics-surface-2: #0f172a;
		--ics-surface-3: #1e293b;
		--ics-ink: #f1f5f9;
		--ics-ink-2: #cbd5e1;
		--ics-muted: #94a3b8;
		--ics-border: #23304a;
		--ics-border-2: #334155;
		--ics-primary: #818cf8;
		--ics-primary-hover: #a5b4fc;
		--ics-primary-contrast: #0b1120;
		--ics-primary-soft: #1e214a;
		--ics-success: #34d399;
		--ics-success-soft: #0c2b23;
		--ics-warning: #fbbf24;
		--ics-danger: #f87171;
		--ics-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
		--ics-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
		--ics-shadow-lg: 0 20px 44px rgba(0, 0, 0, 0.55);
		--ics-ring: 0 0 0 3px rgba(129, 140, 248, 0.4);
	}
}

/* ---- Base ---- */
.ics-body {
	margin: 0;
	background: var(--ics-bg);
	color: var(--ics-ink);
	font-family: var(--ics-font);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

.ics-body * {
	box-sizing: border-box;
}

/* :where() keeps this at low specificity so component classes (.ics-btn,
   .ics-nav-link, .ics-related-card, etc.) always win over the base link
   color — otherwise a primary button's text renders indigo-on-indigo. */
.ics-body :where(a) {
	color: var(--ics-primary);
	text-decoration: none;
}

.ics-body h1,
.ics-body h2,
.ics-body h3,
.ics-body h4 {
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.2;
	color: var(--ics-ink);
	text-wrap: balance;
	margin: 0 0 0.5em;
}

.ics-shell {
	min-height: 60vh;
}

.ics-wrap {
	max-width: var(--ics-maxw);
	margin: 0 auto;
	padding-left: 20px;
	padding-right: 20px;
}

.ics-eyebrow {
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: 12px;
	font-weight: 700;
	color: var(--ics-primary);
}

/* ---- Buttons ---- */
.ics-btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1;
	padding: 11px 18px;
	border-radius: var(--ics-r-pill);
	border: 1px solid var(--ics-border-2);
	background: var(--ics-surface);
	color: var(--ics-ink);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
	text-decoration: none;
}

.ics-btn:hover {
	border-color: var(--ics-primary);
	color: var(--ics-primary);
}

.ics-btn:active {
	transform: translateY(1px);
}

.ics-btn-primary {
	background: var(--ics-primary);
	border-color: var(--ics-primary);
	color: var(--ics-primary-contrast);
	box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28);
}

.ics-btn-primary:hover {
	background: var(--ics-primary-hover);
	border-color: var(--ics-primary-hover);
	color: var(--ics-primary-contrast);
}

.ics-btn-ghost {
	background: transparent;
	border-color: transparent;
	color: var(--ics-ink-2);
}

.ics-btn-ghost:hover {
	background: var(--ics-surface-3);
	color: var(--ics-ink);
	border-color: transparent;
}

.ics-btn:focus-visible,
.ics-icon-btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
	outline: none;
	box-shadow: var(--ics-ring);
}

.ics-icon-btn {
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--ics-r-pill);
	border: 1px solid var(--ics-border);
	background: var(--ics-surface);
	color: var(--ics-ink-2);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ics-icon-btn:hover {
	background: var(--ics-surface-3);
	color: var(--ics-primary);
	border-color: var(--ics-border-2);
}

.ics-icon-btn svg {
	width: 18px;
	height: 18px;
}

/* ---- Header ---- */
.ics-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: color-mix(in srgb, var(--ics-bg) 88%, transparent);
	backdrop-filter: saturate(160%) blur(12px);
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ics-header.is-stuck {
	border-bottom-color: var(--ics-border);
	box-shadow: var(--ics-shadow-sm);
}

.ics-header-inner {
	height: var(--ics-header-h);
	display: flex;
	align-items: center;
	gap: 18px;
}

.ics-logo {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 800;
	font-size: 18px;
	letter-spacing: -0.03em;
	color: var(--ics-ink);
	white-space: nowrap;
}

.ics-logo-mark {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--ics-primary), #7c73f0);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 17px;
	box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.ics-logo-mark svg { width: 19px; height: 19px; }

.ics-nav {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-left: 8px;
}

.ics-nav-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 14px;
	border-radius: var(--ics-r-pill);
	font-size: 14.5px;
	font-weight: 600;
	color: var(--ics-ink-2);
	cursor: pointer;
	background: none;
	border: none;
	font-family: inherit;
}

.ics-nav-link:hover {
	background: var(--ics-surface-3);
	color: var(--ics-ink);
}

.ics-nav-link svg { width: 15px; height: 15px; opacity: 0.7; }

.ics-header-actions {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 10px;
}

/* Instant site-wide search */
.ics-search { position: relative; }
.ics-search-ico {
	position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
	color: var(--ics-ink-soft); pointer-events: none;
}
.ics-search-input {
	width: 220px; max-width: 42vw; height: 40px;
	padding: 0 14px 0 36px; border-radius: var(--ics-r-pill);
	border: 1px solid var(--ics-border); background: var(--ics-surface-2);
	color: var(--ics-ink); font-size: 14px; font-family: inherit;
	transition: width .18s ease, border-color .15s ease, box-shadow .15s ease;
}
.ics-search-input::placeholder { color: var(--ics-ink-soft); }
.ics-search-input:focus {
	outline: none; width: 300px; border-color: var(--ics-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--ics-primary) 18%, transparent);
}
.ics-search-results {
	position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-width: 86vw;
	background: var(--ics-surface); border: 1px solid var(--ics-border);
	border-radius: var(--ics-r-lg); box-shadow: var(--ics-shadow-lg);
	padding: 6px; z-index: 60; max-height: 60vh; overflow-y: auto;
}
.ics-search-item {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	padding: 10px 12px; border-radius: var(--ics-r-sm); text-decoration: none;
	color: var(--ics-ink);
}
.ics-search-item:hover, .ics-search-item.is-active { background: var(--ics-surface-2); }
.ics-search-item-t { font-weight: 600; font-size: 14px; }
.ics-search-item-c {
	font-size: 11px; font-weight: 600; color: var(--ics-ink-soft);
	background: var(--ics-bg); border: 1px solid var(--ics-border);
	padding: 3px 8px; border-radius: var(--ics-r-pill); white-space: nowrap; flex-shrink: 0;
}
.ics-search-empty { padding: 14px 12px; color: var(--ics-ink-soft); font-size: 14px; }
/* Categories mega-dropdown */
.ics-dropdown {
	position: relative;
}

.ics-dropdown-panel {
	position: absolute;
	top: calc(100% + 12px);
	left: 0;
	width: min(620px, 90vw);
	background: var(--ics-surface);
	border: 1px solid var(--ics-border);
	border-radius: var(--ics-r-lg);
	box-shadow: var(--ics-shadow-lg);
	padding: 12px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}

.ics-dropdown.is-open .ics-dropdown-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.ics-dropdown-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: var(--ics-r);
	color: var(--ics-ink);
}

.ics-dropdown-item:hover {
	background: var(--ics-surface-3);
}

.ics-dropdown-ico {
	width: 38px;
	height: 38px;
	flex: 0 0 38px;
	border-radius: 10px;
	background: var(--ics-primary-soft);
	color: var(--ics-primary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.ics-dropdown-ico svg { width: 19px; height: 19px; }

.ics-dropdown-item strong { font-size: 14px; font-weight: 700; display: block; }
.ics-dropdown-item span { font-size: 12px; color: var(--ics-muted); }

/* Mobile menu button */
.ics-burger { display: none; }

/* ---- Footer ---- */
.ics-footer {
	background: var(--ics-surface-2);
	border-top: 1px solid var(--ics-border);
	margin-top: 64px;
}

.ics-footer-top {
	display: grid;
	grid-template-columns: 1.6fr 1fr 1fr 1fr;
	gap: 40px;
	/* vertical-only so the .ics-wrap horizontal padding survives on mobile */
	padding-top: 56px;
	padding-bottom: 40px;
}

.ics-footer-brand .ics-logo { margin-bottom: 14px; }

.ics-footer-brand p {
	color: var(--ics-muted);
	font-size: 14px;
	max-width: 34ch;
	margin: 0 0 18px;
}

.ics-social {
	display: flex;
	gap: 10px;
}

.ics-footer-col h4 {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--ics-muted);
	margin: 0 0 16px;
	font-weight: 700;
}

.ics-footer-col ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 11px;
}

.ics-footer-col a {
	color: var(--ics-ink-2);
	font-size: 14px;
}

.ics-footer-col a:hover { color: var(--ics-primary); }

.ics-footer-bottom {
	border-top: 1px solid var(--ics-border);
	padding-top: 20px;
	padding-bottom: 28px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	color: var(--ics-muted);
	font-size: 13px;
}

.ics-footer-bottom .ics-disclaimer { max-width: 68ch; }

/* ---- Mobile drawer ---- */
.ics-drawer-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(2, 6, 23, 0.5);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s;
	z-index: 200;
}

.ics-drawer {
	position: fixed;
	top: 0;
	right: 0;
	height: 100%;
	width: min(320px, 86vw);
	background: var(--ics-surface);
	border-left: 1px solid var(--ics-border);
	transform: translateX(100%);
	transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 201;
	padding: 20px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

body.ics-drawer-open .ics-drawer-backdrop { opacity: 1; visibility: visible; }
body.ics-drawer-open .ics-drawer { transform: translateX(0); }

.ics-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.ics-drawer a,
.ics-drawer button.ics-drawer-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 12px;
	border-radius: var(--ics-r);
	color: var(--ics-ink);
	font-weight: 600;
	font-size: 15px;
	background: none;
	border: none;
	font-family: inherit;
	width: 100%;
	text-align: left;
	cursor: pointer;
}

.ics-drawer a:hover,
.ics-drawer button.ics-drawer-link:hover { background: var(--ics-surface-3); }

.ics-drawer-ico { color: var(--ics-primary); display: inline-flex; }
.ics-drawer-ico svg { width: 18px; height: 18px; }

.ics-drawer-sep {
	height: 1px;
	background: var(--ics-border);
	margin: 10px 0;
}

.ics-drawer-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: auto;
	padding-top: 16px;
}

.ics-drawer-actions .ics-btn { width: 100%; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
	.ics-footer-top { grid-template-columns: 1fr 1fr; gap: 32px; }
	.ics-footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
	.ics-nav { display: none; }
	.ics-burger { display: inline-flex; }

	/* Tighten the row; show only the logo icon (hide the brand text). */
	.ics-header-inner { position: relative; gap: 10px; }
	.ics-logo { min-width: 0; }
	.ics-logo > span:not(.ics-logo-mark) { display: none; }

	/* Idle: search fills the space between the logo and the icons — flexible,
	   never fixed-width, so it can't push siblings off screen. */
	.ics-header-actions { margin-left: auto; flex: 1 1 auto; min-width: 0; gap: 8px; }
	.ics-icon-btn { flex-shrink: 0; }
	.ics-search { flex: 1 1 auto; min-width: 0; }
	/* 16px avoids iOS auto-zoom on focus. */
	.ics-search-input { width: 100%; max-width: 100%; font-size: 16px; }

	/* Active: expand across the whole header row so the field is full width,
	   with full-width (centered) results — no more cramped little box. */
	.ics-search:focus-within {
		position: absolute; left: 0; right: 0; top: 50%;
		transform: translateY(-50%); z-index: 70;
	}
	.ics-search:focus-within .ics-search-input { width: 100%; }
	.ics-search-results { left: 0; right: 0; width: auto; max-width: none; }
}

@media (max-width: 560px) {
	.ics-footer-top { grid-template-columns: 1fr; gap: 28px; }
	.ics-footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; }
	.ics-drawer, .ics-dropdown-panel, .ics-btn { transition: none !important; }
}

/* ---- Generic legal/info page ---- */
.ics-doc {
	padding: 40px 0 20px;
}

.ics-doc-inner {
	max-width: 760px;
	margin: 0 auto;
}

.ics-doc h1 { font-size: 34px; margin-bottom: 10px; }
.ics-doc .ics-doc-meta { color: var(--ics-muted); font-size: 14px; margin-bottom: 32px; }
.ics-doc h2 { font-size: 22px; margin-top: 36px; }
.ics-doc h3 { font-size: 17px; margin-top: 24px; }
.ics-doc p, .ics-doc li { color: var(--ics-ink-2); }
.ics-doc ul { padding-left: 20px; }
.ics-doc li { margin-bottom: 8px; }
