/* ============================================================
   krysion.css — the Krysion design language, shared base
   https://www.krysion.com/krysion.css

   Every Krysion site links this file, then its own stylesheet.
   The rules behind every value are in DESIGN.md (Krysion Website
   repo); when the two disagree, DESIGN.md wins and this file is
   fixed. A deploy of krysion.com restyles every site that links
   it, so changes here are gated like footer.js and cookies.js.

   A site sets   :root { --accent: #…; }
   (and --on-accent when the contrast rule in DESIGN.md §2.3 says so),
   and may set its own palette, DESIGN.md §2.16: the neutral and
   surface tokens below, with the same selectors, after this file.
   Dark theme: <html data-theme="dark">, or always-dark sites put
   class="theme-dark" on <html>.
   ============================================================ */

@font-face {
	font-family: "Gabarito";
	src: url("https://www.krysion.com/assets/fonts/Gabarito-VariableFont_wght.woff2") format("woff2");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
}

/* ---------- 1. Tokens ---------- */
:root {
	/* accent group (DESIGN §2.3) */
	--accent: #7C44FF;
	--on-accent: #ffffff;
	--accent-hover: color-mix(in srgb, var(--accent) 84%, #000);
	--accent-text: color-mix(in srgb, var(--accent) 80%, var(--ink));
	--accent-15: color-mix(in srgb, var(--accent) 15%, var(--page));
	--accent-12: color-mix(in srgb, var(--accent) 12%, var(--page));
	--accent-8: color-mix(in srgb, var(--accent) 8%, var(--page));

	/* neutrals, plum (DESIGN §2.1) */
	--ink: #1a1320;
	--ink-2: #4a4453;
	--muted: #857e90;
	--line: #ece6f0;
	--line-strong: #ddd4e4;
	--page: #ffffff;
	--card: #f6f2f8;
	--card-hover: color-mix(in srgb, var(--ink) 6%, var(--card));
	--raised: #ffffff;
	--soft: rgba(26, 19, 32, .06);
	--soft-2: rgba(26, 19, 32, .11);
	--backdrop: rgba(26, 19, 32, .5);
	--scrim: rgba(26, 19, 32, .45);
	--chrome: color-mix(in srgb, var(--page) 82%, transparent);
	--float: color-mix(in srgb, var(--card) 90%, transparent);
	--chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23857e90' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

	/* status (DESIGN §2.4) */
	--success: #1f9d55;
	--danger: #d64545;
	--warning: #c27a00;
	--on-danger: #ffffff;
	--toast-ok: #1f9d55;
	--toast-err: #d64545;

	/* elevation (DESIGN §2.9) */
	--shadow-md: 0 14px 40px rgba(26, 19, 32, .16), 0 2px 6px rgba(26, 19, 32, .06);
	--shadow-lg: 0 24px 64px rgba(26, 19, 32, .2);

	/* shape (DESIGN §2.7) */
	--r-xs: 6px;
	--r-tip: 8px;
	--r-row: 14px;
	--r-pop: 20px;
	--r-card: 24px;
	--r-modal: 28px;
	--r-pill: 999px;

	/* type (DESIGN §2.5) */
	--font: "Gabarito", system-ui, -apple-system, "Segoe UI", sans-serif;
	--mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

	/* controls + icons (DESIGN §2.8) */
	--ctl: 48px;
	--ctl-sm: 40px;
	--ic-btn: 18px;
	--ic: 20px;
	--ic-sm: 18px;
	--ic-row: 16px;

	/* layout (DESIGN §3) */
	--maxw: 1120px;
	--gutter: 24px;
	--header-h: 64px;
	--section: 96px;
	--safe-t: env(safe-area-inset-top, 0px);
	--safe-b: env(safe-area-inset-bottom, 0px);

	/* layers (DESIGN §2.10) */
	--z-sticky: 50;
	--z-header: 100;
	--z-menu: 200;
	--z-cookie: 900;
	--z-modal: 1000;
	--z-toast: 2000;
	--z-tooltip: 2100;

	/* motion (DESIGN §2.11) */
	--ease-out: cubic-bezier(.2, .8, .2, 1);
	--t-press: 120ms;
	--t-fast: 150ms;
	--t-menu: 180ms;
	--t-exit: 200ms;
	--t-toast: 240ms;
	--t-modal: 280ms;
	--t-sheet: 300ms;
	--t-reveal: 450ms;

	color-scheme: light;
}
:root[data-theme="dark"], :root.theme-dark {
	--accent-hover: color-mix(in srgb, var(--accent) 84%, #fff);
	--ink: #ece8f2;
	--ink-2: #c3bcd1;
	--muted: #8b839a;
	--line: #2a2336;
	--line-strong: #372e47;
	--page: #14101b;
	--card: #1d1828;
	--raised: #1d1828;
	--soft: rgba(236, 232, 242, .06);
	--soft-2: rgba(236, 232, 242, .11);
	--backdrop: rgba(5, 3, 8, .6);
	--scrim: rgba(5, 3, 8, .6);
	--chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b839a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	--success: #4ade80;
	--danger: #ff6b6b;
	--warning: #f5b544;
	--on-danger: #2a0b0b;
	--shadow-md: 0 14px 40px rgba(0, 0, 0, .55);
	--shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
	color-scheme: dark;
}
@media (max-width: 600px) { :root { --gutter: 16px; --section: 64px; } }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--page); -webkit-text-size-adjust: 100%; }
body {
	margin: 0; font-family: var(--font); font-size: 16px; font-weight: 400; line-height: 1.6;
	color: var(--ink); background: var(--page);
	-webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; color: var(--ink); }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scroll-thin { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 3. Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--section) 0; }
.section-title { font-size: clamp(1.8rem, 4vw, 2.6rem); text-align: center; margin: 0 0 40px; text-wrap: balance; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.meta { font-size: .88rem; color: var(--muted); }
@media (max-width: 600px) { .section-title { margin-bottom: 28px; } }

/* ---------- 4. Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 9px;
	height: var(--ctl); padding: 0 22px; border: 2px solid transparent; border-radius: var(--r-pill);
	font-family: var(--font); font-size: 1.02rem; font-weight: 700; line-height: 1; white-space: nowrap;
	text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
	transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn > svg, .btn > i { font-size: var(--ic-btn); width: 1em; height: 1em; flex: none; }
.btn-sm { height: var(--ctl-sm); padding: 0 18px; font-size: .95rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: var(--soft); color: var(--ink); }
.btn-text { background: transparent; color: var(--ink-2); }
.btn-danger { background: color-mix(in srgb, var(--danger) 11%, transparent); color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: var(--on-danger); }
.btn-on-color { background: transparent; border-color: #fff; color: #fff; }
.btn-white { background: #fff; color: #1a1320; }
@media (hover: hover) {
	.btn:hover { transform: translateY(-2px); }
	.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
	.btn-secondary:hover { background: var(--soft-2); color: var(--ink); }
	.btn-text:hover { background: var(--soft); color: var(--ink); transform: none; }
	.btn-danger:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }
	.btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
	:root[data-theme="dark"] .btn-danger-solid:hover, :root.theme-dark .btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 88%, #fff); }
	.btn-on-color:hover { background: rgba(255, 255, 255, .14); color: #fff; }
	.btn-white:hover { background: rgba(255, 255, 255, .86); color: #1a1320; }
}
.btn:active { transform: scale(.97); transition-duration: var(--t-press); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; pointer-events: none; }
.btn.busy { position: relative; color: transparent !important; cursor: progress; pointer-events: none; }
.btn.busy > * { visibility: hidden; }
.btn.busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; --sp-c: var(--spin, var(--ink)); --sp-w: 3px; }
.btn-primary.busy { --spin: var(--on-accent); }
.btn-danger-solid.busy { --spin: var(--on-danger); }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.icon-btn {
	display: inline-grid; place-items: center; flex: none;
	width: var(--ctl); height: var(--ctl); padding: 0; border: 0; border-radius: 50%;
	background: var(--soft); color: var(--ink-2); font-size: var(--ic); cursor: pointer;
	-webkit-tap-highlight-color: transparent; touch-action: manipulation;
	transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-press);
}
.icon-btn > svg, .icon-btn > i { width: 1em; height: 1em; }
.icon-btn-sm { width: var(--ctl-sm); height: var(--ctl-sm); font-size: var(--ic-sm); }
@media (hover: hover) { .icon-btn:hover { background: var(--soft-2); color: var(--ink); } }
.icon-btn:active { transform: scale(.94); }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
@media (pointer: coarse) { .btn-sm, .icon-btn-sm { position: relative; } .btn-sm::before, .icon-btn-sm::before { content: ""; position: absolute; inset: -2px; } }

/* ---------- 5. Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .9rem; font-weight: 700; color: var(--ink); }
.hint { font-size: .85rem; color: var(--muted); }
.error-text { font-size: .85rem; color: var(--danger); display: flex; align-items: center; gap: 6px; }
.input, .select, .textarea {
	width: 100%; height: var(--ctl); margin: 0; padding: 0 18px;
	font-family: var(--font); font-size: 1rem; color: var(--ink);
	background: var(--soft); border: 2px solid transparent; border-radius: var(--r-pill); outline: none;
	transition: border-color var(--t-fast), background-color var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); background: transparent; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
.textarea { height: auto; min-height: 120px; padding: 12px 18px; border-radius: var(--r-card); line-height: 1.5; resize: vertical; }
.select { appearance: none; -webkit-appearance: none; padding-right: 46px; cursor: pointer; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 18px center; background-size: 16px; }
.dropdown { position: relative; display: block; }
.dropdown.inline { display: inline-block; min-width: 200px; }
.dropdown > .select { display: flex; align-items: center; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown > .select[aria-expanded="true"] { border-color: var(--accent); background-color: transparent; }
.dropdown > .menu { top: calc(100% + 8px); left: 0; min-width: 100%; max-height: 320px; overflow-y: auto; display: none; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.dropdown.open > .menu { display: flex; }
.dropdown.closing > .menu { display: flex; animation: k-lift var(--t-fast) ease both; pointer-events: none; }
.dropdown.up > .menu { top: auto; bottom: calc(100% + 8px); animation-name: k-rise; }
.dropdown.up.closing > .menu { animation-name: k-sink; }
.search { position: relative; }
.search > svg, .search > i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--muted); pointer-events: none; }
.search > .input { padding: 0 46px; }
.search > .icon-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; font-size: 14px; }

.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0; display: grid; place-items: center; background: var(--soft-2); border-radius: 7px; cursor: pointer; transition: background-color var(--t-fast); }
.check input[type="radio"] { border-radius: 50%; }
@media (hover: hover) { .check:hover input:not(:checked) { background: color-mix(in srgb, var(--ink) 16%, transparent); } }
.check input:checked { background: var(--accent); }
.check input[type="checkbox"]:checked::after { content: ""; width: 11px; height: 6px; border-left: 2.5px solid var(--on-accent); border-bottom: 2.5px solid var(--on-accent); transform: translateY(-1px) rotate(-45deg); }
.check input[type="radio"]:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--on-accent); }
.check input:disabled { opacity: .45; cursor: not-allowed; }

.switch { position: relative; display: inline-block; flex: none; width: 48px; height: 28px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--soft-2); transition: background-color 200ms; }
:root[data-theme="dark"] .switch input:not(:checked) + i, :root.theme-dark .switch input:not(:checked) + i { background: rgba(236, 232, 242, .22); }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 200ms var(--ease-out); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.setting { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.setting > .grow { flex: 1; min-width: 0; }
.setting > .grow > b { display: block; font-weight: 700; }
.setting > .grow > small { display: block; font-size: .88rem; color: var(--muted); }
.slider-row { display: flex; align-items: center; gap: 14px; min-height: 44px; }
.slider-row > svg, .slider-row > i { flex: none; width: 1.2em; font-size: var(--ic-sm); color: var(--muted); }
.slider-row > output, .slider-row > .value { width: 3ch; text-align: right; font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; --pct: 50%; }
.slider::-webkit-slider-runnable-track { height: 6px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent) var(--pct), var(--soft-2) var(--pct)); }
.slider::-moz-range-track { height: 6px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent) var(--pct), var(--soft-2) var(--pct)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border: 0; border-radius: 50%; background: #fff; }
.slider::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; }

/* ---------- 6. Chips + segmented control ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
	display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
	border: 0; border-radius: var(--r-pill); background: var(--soft); color: var(--ink-2);
	font-family: var(--font); font-size: .92rem; font-weight: 700; white-space: nowrap; text-decoration: none; cursor: pointer;
	transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-press);
}
.chip > svg, .chip > i { font-size: 14px; }
@media (hover: hover) { .chip:hover { background: var(--soft-2); color: var(--ink); } }
.chip:active, .seg > button:active { transform: scale(.94); }
.chip.on, .chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.seg { display: inline-flex; gap: 2px; padding: 4px; max-width: 100%; border-radius: var(--r-pill); background: var(--soft); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg.block { display: flex; }
.seg.block > button { flex: 1; justify-content: center; }
.seg > button {
	display: inline-flex; align-items: center; gap: 7px; flex: none; height: var(--ctl-sm); padding: 0 16px;
	border: 0; border-radius: var(--r-pill); background: none; color: var(--muted);
	font-family: var(--font); font-size: .95rem; font-weight: 700; white-space: nowrap; cursor: pointer;
	transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-press);
}
@media (hover: hover) { .seg > button:hover { color: var(--ink); } }
.seg > button.on, .seg > button[aria-selected="true"], .seg > button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- 7. Cards, rows ---------- */
.card { background: var(--card); border-radius: var(--r-card); padding: 24px; color: var(--ink); min-width: 0; }
.card-title { font-size: 1.2rem; margin: 0 0 8px; }
.card-link { display: block; text-decoration: none; cursor: pointer; transition: background-color var(--t-fast), transform var(--t-fast); }
@media (hover: hover) { .card-link:hover { background: var(--card-hover); color: var(--ink); transform: translateY(-2px); } }
.card-emph { background: var(--accent-8); }
.modal .card, .menu .card { background: var(--soft); }
.card-icon { display: block; width: 1em; height: 1em; margin-bottom: 14px; font-size: 28px; line-height: 1; color: var(--accent); }
.grid { display: grid; gap: 24px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(min(var(--cols, 3), 2), minmax(0, 1fr)); } }
@media (max-width: 600px) { .card { padding: 20px; } .grid { grid-template-columns: 1fr; gap: 16px; } }

.rows { display: flex; flex-direction: column; gap: 2px; }
.row {
	display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 14px;
	border-radius: var(--r-pill); color: var(--ink); text-decoration: none; cursor: pointer;
	transition: background-color var(--t-fast);
}
.row > b, .row > .grow { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row > .row-icon { flex: none; width: 1.2em; font-size: var(--ic); text-align: center; color: var(--muted); }
.row > .row-num { flex: none; min-width: 24px; text-align: center; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.row > .row-meta { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.row > .row-tick { color: var(--accent); font-size: 16px; visibility: hidden; }
@media (hover: hover) { .row:hover { background: var(--soft); } }
.row[aria-current] { background: var(--accent-12); color: var(--accent-text); }
.row[aria-current] > .row-icon, .row[aria-current] > .row-num { color: inherit; }
.row.on, .row[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.row.on > .row-meta, .row[aria-selected="true"] > .row-meta, .row.on > .row-icon, .row[aria-selected="true"] > .row-icon, .row.on > .row-num, .row[aria-selected="true"] > .row-num { color: var(--on-accent); opacity: .8; }
.row.on > .row-tick, .row[aria-selected="true"] > .row-tick { visibility: visible; color: var(--on-accent); }
@media (hover: hover) { .row.on:hover, .row[aria-selected="true"]:hover { background: var(--accent-hover); } }
.row.tall { border-radius: var(--r-pop); }
.row.locked, .row[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }
.row.locked:hover, .row[aria-disabled="true"]:hover { background: none; }
.row.locked > .row-icon, .row.locked > .row-num { color: var(--muted); }

/* ---------- 8. Menus, tooltips ---------- */
.menu {
	position: absolute; z-index: var(--z-menu); display: flex; flex-direction: column; gap: 2px;
	min-width: 240px; max-width: calc(100vw - 16px); padding: 8px;
	background: var(--raised); border-radius: var(--r-pop); box-shadow: var(--shadow-md);
	animation: k-drop var(--t-menu) var(--ease-out) both;
}
.menu.closing { animation: k-lift var(--t-fast) ease both; pointer-events: none; }
.menu-item {
	display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 16px;
	border: 0; border-radius: var(--r-pill); background: none; color: var(--ink);
	font-family: var(--font); font-size: .95rem; font-weight: 700; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer;
	transition: background-color var(--t-fast);
}
.menu-item > svg, .menu-item > i { width: 1.15em; font-size: 18px; color: var(--muted); }
@media (hover: hover) { .menu-item:hover { background: var(--soft); } }
.menu-item.danger, .menu-item.danger > svg, .menu-item.danger > i { color: var(--danger); }
@media (hover: hover) { .menu-item.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); } }
.menu-item.primary { background: var(--accent); color: var(--on-accent); justify-content: center; }
.menu-item.primary > svg, .menu-item.primary > i { color: inherit; }
@media (hover: hover) { .menu-item.primary:hover { background: var(--accent-hover); } }
.menu-sep { height: 1px; margin: 6px 16px; background: var(--line); }
.menu-item[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.menu-item[aria-selected="true"] > svg, .menu-item[aria-selected="true"] > i { color: var(--on-accent); }
@media (hover: hover) { .menu-item[aria-selected="true"]:hover { background: var(--accent-hover); } }

.tooltip {
	position: fixed; z-index: var(--z-tooltip); pointer-events: none; white-space: nowrap;
	padding: 6px 10px; border-radius: var(--r-tip); background: var(--ink); color: var(--page);
	font-size: .8rem; font-weight: 700; line-height: 1.4; opacity: 0; transition: opacity 120ms;
}
.tooltip.show { opacity: 1; }

/* ---------- 9. Modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--backdrop); display: none; animation: k-fade var(--t-exit) ease both; }
.modal-backdrop.open { display: block; }
.modal-backdrop.closing { animation: k-fade-out var(--t-exit) ease both; }
.modal {
	position: fixed; z-index: calc(var(--z-modal) + 1); left: 50%; top: 50%; transform: translate(-50%, -50%);
	width: fit-content; min-width: min(360px, calc(100vw - 32px)); max-width: min(560px, calc(100vw - 32px)); max-height: min(88vh, 760px);
	display: none; flex-direction: column; overflow: hidden;
	background: var(--raised); color: var(--ink); border-radius: var(--r-modal); box-shadow: var(--shadow-lg);
}
.modal.modal-confirm { max-width: min(440px, calc(100vw - 32px)); }
.modal.modal-content { width: min(800px, calc(100vw - 32px)); max-width: none; }
.modal.modal-wide { width: min(960px, calc(100vw - 32px)); max-width: none; }
.modal.open { display: flex; animation: k-modal-in var(--t-modal) var(--ease-out) both; }
.modal.open.closing { animation: k-modal-out var(--t-exit) ease both; }
.modal:focus { outline: none; }
.modal-head { flex: none; display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 0 16px 0 24px; }
.modal-head > h2, .modal-head > h3 { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; margin: 0; font-size: 1.3rem; line-height: 1.2; }
.modal-head > h2 > svg, .modal-head > h2 > i, .modal-head > h3 > svg, .modal-head > h3 > i { flex: none; font-size: 22px; width: 1em; color: var(--accent); }
.modal-head > .icon-btn { width: var(--ctl-sm); height: var(--ctl-sm); font-size: var(--ic-sm); }
.modal-tools { flex: none; padding: 0 24px 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 24px 20px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.modal-foot { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px; background: var(--card); border-top: 1px solid var(--line); }
.modal-foot > .start { margin-right: auto; }
body.modal-open { overflow: hidden; }
@media (max-width: 600px) {
	.modal, .modal.modal-confirm, .modal.modal-content, .modal.modal-wide {
		left: 0; right: 0; top: auto; bottom: 0; transform: none;
		width: 100%; min-width: 0; max-width: none; max-height: calc(100dvh - var(--safe-t) - 40px);
		border-radius: var(--r-modal) var(--r-modal) 0 0;
	}
	.modal.open { animation: k-sheet-in var(--t-sheet) var(--ease-out) both; }
	.modal.open.closing { animation: k-sheet-out 220ms ease both; }
	.modal-head { padding: 0 12px 0 20px; }
	.modal-tools { padding: 0 20px 12px; }
	.modal-body { padding: 0 20px 16px; }
	.modal:not(:has(.modal-foot)) .modal-body { padding-bottom: calc(24px + var(--safe-b)); }
	.modal-foot { padding: 14px 20px calc(22px + var(--safe-b)); }
	.modal-foot > .btn { flex: 1; }
	.modal-foot > .start { flex-basis: 100%; margin: 0; }
}

/* ---------- 10. Toasts ---------- */
.toast-host {
	position: fixed; z-index: var(--z-toast); top: calc(var(--header-h) + var(--safe-t) + 12px); right: 16px;
	width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none;
}
.toast {
	display: flex; align-items: center; gap: 12px; max-width: 100%; min-height: 48px; padding: 12px 18px 12px 14px;
	border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-md);
	font-size: .95rem; font-weight: 700; line-height: 1.35; pointer-events: auto; cursor: pointer;
	animation: k-toast-in var(--t-toast) var(--ease-out) both;
}
.toast > svg, .toast > i { flex: none; width: 20px; height: 20px; font-size: 20px; }
.toast.ok { background: var(--toast-ok); color: #fff; }
.toast.err { background: var(--toast-err); color: #fff; }
.toast.multi { border-radius: 20px; }
.toast.leaving { animation: k-toast-out var(--t-exit) ease both; }
@media (max-width: 600px) {
	.toast-host { top: calc(var(--header-h) + var(--safe-t) + 8px); left: 12px; right: 12px; width: auto; align-items: stretch; }
	.toast { animation-name: k-toast-drop; animation-duration: 220ms; }
}

/* ---------- 11. Badges, counts, avatars ---------- */
.badge {
	display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: var(--r-pill);
	background: color-mix(in srgb, var(--badge, var(--accent)) 15%, var(--page)); color: color-mix(in srgb, var(--badge, var(--accent)) 78%, var(--ink));
	font-size: .82rem; font-weight: 700; white-space: nowrap;
}
.badge > svg, .badge > i { font-size: 12px; }
.badge.ok { --badge: var(--success); }
.badge.err { --badge: var(--danger); }
.badge.warn { --badge: var(--warning); }
.badge.neutral { --badge: var(--muted); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: .72rem; font-weight: 700; font-style: normal; line-height: 1; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--accent-15); color: var(--accent); display: inline-grid; place-items: center; font-weight: 700; }
/* a clickable avatar is a photo: it brightens a little on hover (DESIGN §4.17) */
:is(a, button) .avatar, .avatar.clickable { transition: filter var(--t-fast), transform var(--t-press) var(--ease-out); }
@media (hover: hover) { :is(a, button):hover .avatar, .avatar.clickable:hover { filter: brightness(1.1); } }
.avatar-sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 2rem; }
.avatar-xl { width: 128px; height: 128px; font-size: 2.6rem; }
.avatar-stack { display: flex; }
.avatar-stack > .avatar { box-shadow: 0 0 0 2px var(--surface, var(--page)); }
.avatar-stack > .avatar + .avatar { margin-left: -10px; }

/* ---------- 12. Header, phone menu, side nav ---------- */
.site-header {
	position: sticky; top: 0; z-index: var(--z-header); height: calc(var(--header-h) + var(--safe-t)); padding-top: var(--safe-t);
	background: var(--chrome); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
}
.site-header > .wrap { height: 100%; display: flex; align-items: center; gap: 16px; }
.site-header .btn, .site-header .icon-btn, .site-header .btn:hover { transform: none; }
.site-header .btn, .site-header .icon-btn { will-change: transform; }   /* the press shrink stays; a promoted layer stops Chrome repainting it in tiles under the blur */
.site-header .btn:active { transform: scale(.97); }
.site-header .icon-btn:active { transform: scale(.94); }
.wordmark { display: inline-flex; align-items: center; gap: 9px; margin-right: auto; color: var(--ink); font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; text-decoration: none; }
.wordmark > svg, .wordmark > img { height: .95em; width: auto; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links > a:not(.btn) { display: inline-flex; align-items: center; gap: 8px; height: var(--ctl-sm); padding: 0 16px; border-radius: var(--r-pill); color: var(--ink-2); font-size: .98rem; font-weight: 700; text-decoration: none; transition: background-color var(--t-fast), color var(--t-fast); }
.nav-links > a:not(.btn) > svg, .nav-links > a:not(.btn) > i { font-size: var(--ic-sm); }
@media (hover: hover) { .nav-links > a:not(.btn):hover { background: var(--soft); color: var(--ink); } }
.nav-links > a:not(.btn)[aria-current="page"] { color: var(--accent-text); }
.nav-links > .btn { margin-left: 8px; }
.menu-btn { display: none; }
.phone-menu { display: none; }
@media (max-width: 760px) {
	.site-header > .wrap { padding: 0 12px 0 16px; }
	.site-header .nav-links { display: none; }
	.menu-btn { display: inline-grid; width: var(--ctl-sm); height: var(--ctl-sm); font-size: var(--ic-sm); }
	.phone-menu.open, .phone-menu.closing { display: block; position: fixed; inset: calc(var(--header-h) + var(--safe-t)) 0 0; z-index: calc(var(--z-header) - 1); background: var(--scrim); animation: k-fade var(--t-exit) ease both; }
	.phone-menu.closing { animation: k-fade-out var(--t-fast) ease both; pointer-events: none; }
	.phone-menu.closing .phone-menu-panel { animation: k-lift var(--t-fast) ease both; }
	.phone-menu-panel { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 16px; background: var(--raised); box-shadow: 0 16px 32px rgba(26, 19, 32, .14); animation: k-drop var(--t-menu) var(--ease-out) both; }
	.phone-menu-panel > a:not(.btn) { display: flex; align-items: center; gap: 12px; height: var(--ctl); padding: 0 16px; border-radius: var(--r-pill); color: var(--ink); font-size: 1.02rem; font-weight: 700; text-decoration: none; }
	.phone-menu-panel > a:not(.btn) > svg, .phone-menu-panel > a:not(.btn) > i { width: 1.2em; font-size: var(--ic); color: var(--muted); }
	.phone-menu-panel > a[aria-current="page"] { background: var(--accent-12); color: var(--accent-text); }
	.phone-menu-panel > a[aria-current="page"] > svg, .phone-menu-panel > a[aria-current="page"] > i { color: inherit; }
	.phone-menu-panel > .btn { margin-top: 10px; width: 100%; }
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav-label { padding: 14px 16px 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.side-nav-label:first-child { padding-top: 0; }
.side-nav > a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px; border-radius: var(--r-pill); color: var(--ink-2); font-size: .95rem; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background-color var(--t-fast), color var(--t-fast); }
.side-nav > a > svg, .side-nav > a > i { width: 1.15em; font-size: var(--ic); color: var(--muted); }
@media (hover: hover) { .side-nav > a:hover { background: var(--soft); color: var(--ink); } }
.side-nav > a[aria-current], .side-nav > a.on { background: var(--accent); color: var(--on-accent); }
@media (hover: hover) { .side-nav > a[aria-current]:hover, .side-nav > a.on:hover { background: var(--accent-hover); color: var(--on-accent); } }
.side-nav > a[aria-current] > svg, .side-nav > a[aria-current] > i, .side-nav > a.on > svg, .side-nav > a.on > i { color: inherit; }
.jump { display: none; }
@media (max-width: 760px) {
	.jump { display: flex; align-items: center; gap: 10px; width: 100%; height: var(--ctl); padding: 0 18px; border: 0; border-radius: var(--r-pill); background: var(--soft); color: var(--ink); font-family: var(--font); font-size: 1rem; font-weight: 700; cursor: pointer; }
	.jump > :last-child { margin-left: auto; color: var(--muted); }
}

/* ---------- 13. Page hero, prose, callouts, code, tables ---------- */
.page-hero { background: var(--card); text-align: center; padding: 64px 0 52px; margin-bottom: 36px; }
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); letter-spacing: -.02em; margin: 0 0 12px; text-wrap: balance; }
.page-hero p { font-size: 1.15rem; color: var(--ink-2); max-width: 56ch; margin: 0 auto; }
@media (max-width: 600px) { .page-hero { padding: 44px 0 36px; } }

.prose { max-width: 760px; margin: 0 auto; font-size: 1.06rem; line-height: 1.7; color: var(--ink-2); }
.prose > :first-child { margin-top: 0; }
.prose .title { font-size: 2.6rem; letter-spacing: -.02em; margin: 0 0 .3em; }
.prose h2 { font-size: 1.6rem; margin: 1.6em 0 .5em; }
.prose h3 { font-size: 1.25rem; margin: 1.4em 0 .4em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .25em 0; }
.prose strong { color: var(--ink); }
.prose a { font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); transition: text-decoration-color var(--t-fast); }
@media (hover: hover) { .prose a:hover { text-decoration-color: var(--accent); } }
.prose :not(pre) > code, code.inline { font-family: var(--mono); font-size: .88em; padding: 2px 7px; border-radius: var(--r-xs); background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); white-space: nowrap; }
@media (max-width: 600px) { .prose .title { font-size: 2.2rem; } .prose :not(pre) > code { white-space: normal; overflow-wrap: anywhere; } }

.callout, .prose blockquote { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 1em; padding: 16px 20px; border-radius: var(--r-row); background: var(--accent-8); color: var(--ink-2); }
.callout > svg:first-child, .callout > i:first-child { flex: none; margin-top: 4px; font-size: 18px; width: 1em; color: var(--accent); }
.callout > p, .prose blockquote > p { margin: 0; }
.prose blockquote { display: block; }
.prose blockquote > p + p { margin-top: .6em; }
.callout.warn { background: color-mix(in srgb, var(--warning) 11%, var(--page)); }
.callout.warn > svg:first-child, .callout.warn > i:first-child { color: var(--warning); }

.code-block { position: relative; margin: 0 0 1em; }
.code-block pre, .prose pre { margin: 0; padding: 16px 20px; overflow-x: auto; border-radius: var(--r-row); background: #1d1726; color: #ece8f2; font-family: var(--mono); font-size: .9rem; line-height: 1.7; }
:root[data-theme="dark"] .code-block pre, :root[data-theme="dark"] .prose pre, :root.theme-dark .code-block pre, :root.theme-dark .prose pre { background: #0f0c15; }
.code-block pre code, .prose pre code { font: inherit; background: none; padding: 0; color: inherit; white-space: pre; }
.code-copy { position: absolute; top: 6px; right: 6px; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: rgba(255, 255, 255, .1); color: #ece8f2; font-family: var(--font); font-size: .82rem; font-weight: 700; cursor: pointer; opacity: 0; transition: opacity var(--t-fast), background-color var(--t-fast); }
.code-block:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
@media (hover: none) { .code-copy { opacity: 1; } }
@media (hover: hover) { .code-copy:hover { background: rgba(255, 255, 255, .18); } }
.tok-key { color: #ff7eb6; } .tok-str { color: #b8e994; } .tok-num { color: #f8c06b; } .tok-com { color: #8a7fa0; font-style: italic; } .tok-pun { color: #c9b6ff; }

.table-wrap { overflow-x: auto; margin: 0 0 1em; }
.table-wrap table, .prose table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table-wrap th, .prose th { text-align: left; vertical-align: bottom; padding: 10px 12px; color: var(--ink); font-weight: 700; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table-wrap td, .prose td { text-align: left; vertical-align: top; padding: 10px 12px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.table-wrap tr:last-child td, .prose tr:last-child td { border-bottom: 0; }
@media (max-width: 600px) { .table-wrap { margin-right: calc(-1 * var(--gutter)); } .table-wrap table { min-width: 520px; } }

/* ---------- 14. Empty, loading, progress, pager ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 20px; text-align: center; }
.empty > .empty-icon { font-size: 40px; width: 1em; height: 1em; color: var(--accent); }
.empty > h3 { margin: 4px 0 0; font-size: 1.15rem; }
.empty > p { max-width: 36ch; color: var(--ink-2); }
.spinner { --sp-c: var(--accent); --sp-w: 4px; display: inline-block; width: 28px; height: 28px; }
.loading { position: relative; }
.loading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; --sp-c: var(--accent); --sp-w: 4px; }
.spinner, .btn.busy::after, .loading::after {
	border-radius: 50%;
	background:
		radial-gradient(farthest-side, var(--sp-c) 94%, transparent) 50% 0 / var(--sp-w) var(--sp-w) no-repeat,
		radial-gradient(farthest-side, var(--sp-c) 94%, transparent) 100% 50% / var(--sp-w) var(--sp-w) no-repeat,
		conic-gradient(transparent 25%, var(--sp-c) 0);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--sp-w)), #000 calc(100% - var(--sp-w) + .5px));
	mask: radial-gradient(farthest-side, transparent calc(100% - var(--sp-w)), #000 calc(100% - var(--sp-w) + .5px));
	animation: k-spin 1s linear infinite;
}
.placeholder { display: block; height: 12px; border-radius: var(--r-xs); background: var(--soft); animation: k-pulse 1.6s ease-in-out infinite; }
.placeholder.circle { width: 44px; height: 44px; border-radius: 50%; }
.progress { display: block; height: 8px; border-radius: var(--r-pill); background: var(--soft-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; animation: k-grow 600ms var(--ease-out) both; }
.pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.pager > a { display: flex; flex-direction: column; gap: 4px; padding: 18px 22px; border-radius: var(--r-card); background: var(--card); text-decoration: none; transition: background-color var(--t-fast), transform var(--t-fast); }
.pager > a.next { grid-column: 2; align-items: flex-end; text-align: right; }
.pager .pager-dir { display: inline-flex; align-items: center; gap: 8px; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.pager .pager-title { font-size: 1.1rem; font-weight: 700; color: var(--accent-text); }
@media (hover: hover) { .pager > a:hover { background: var(--card-hover); transform: translateY(-2px); } }
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager > a.next { grid-column: auto; } }

/* ---------- 15. Reveal on scroll ---------- */
:root.reveal-on .reveal:not(.in) { opacity: 0; }
:root.reveal-on .reveal.in { animation: k-reveal var(--t-reveal) var(--ease-out) backwards; }

/* ---------- 16. Shared Krysion scripts (footer.js, cookies.js) ---------- */
.krysion-footer { --kf-maxw: var(--maxw); --kf-font: var(--font); --kf-bg: var(--card); --kf-border: var(--line); --kf-ink: var(--ink); --kf-ink-soft: var(--ink-2); --kf-hover: var(--soft); --kf-accent: var(--accent-text); }
.krysion-cookies { --kc-bg: var(--raised); --kc-ink: var(--ink); --kc-ink-soft: var(--ink-2); --kc-soft: var(--soft); --kc-soft-2: var(--soft-2); --kc-accent: var(--accent); --kc-accent-hover: var(--accent-hover); --kc-on-accent: var(--on-accent); }

/* ---------- 17. Keyframes ---------- */
@keyframes k-spin { to { transform: rotate(360deg); } }
@keyframes k-reveal { from { opacity: 0; transform: translateY(12px); } }
@keyframes k-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes k-grow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes k-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes k-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes k-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes k-lift { from { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }
@keyframes k-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes k-sink { from { opacity: 1; } to { opacity: 0; transform: translateY(6px); } }
@keyframes k-modal-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.94); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes k-modal-out { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -50%) scale(.96); } }
@keyframes k-sheet-in { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes k-sheet-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(30px); } }
@keyframes k-toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes k-toast-drop { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes k-toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }

/* ---------- 18. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
	:root.reveal-on .reveal:not(.in) { opacity: 1; }
	.spinner, .btn.busy::after, .loading::after { animation: k-spin 1.6s linear infinite !important; }
}
