/* =========================================================================
   kit.css: shared design system for the /solutions/* media widgets.

   Every widget draws on a fixed-size .canvas (data-w / data-h on <body>)
   that kit.js scales to fit the iframe, so widgets are authored in plain px
   at the slot's aspect ratio:
     16:9  hero      1600 x 900
     16:10 modules   1280 x 800
     4:3   rows      1200 x 900
     21:9  flow      1680 x 720
   Tokens mirror demo.css (the real admin/storefront grayscale); kit.js
   mirrors the parent site's .dark class onto <html>.
   ========================================================================= */

:root {
  --bg: oklch(0.985 0 0);
  --fg: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --muted: oklch(0.97 0 0);
  --muted-2: oklch(0.945 0 0);
  --muted-fg: oklch(0.556 0 0);
  --primary: oklch(0.205 0 0);
  --primary-fg: oklch(0.985 0 0);
  --border: oklch(0.922 0 0);
  --border-strong: oklch(0.87 0 0);
  --ring: oklch(0.708 0 0);
  --sidebar: oklch(0.985 0 0);

  --success: oklch(0.55 0.13 152);
  --success-bg: oklch(0.96 0.04 152);
  --warn: oklch(0.55 0.13 70);
  --warn-bg: oklch(0.96 0.06 84);
  --danger: oklch(0.55 0.2 25);
  --danger-bg: oklch(0.96 0.035 25);
  --info: oklch(0.52 0.15 250);
  --info-bg: oklch(0.96 0.03 250);
  --violet: oklch(0.52 0.17 300);
  --violet-bg: oklch(0.96 0.03 300);
  /* the marketing site's orange, used sparingly for "the thing to look at" */
  --accent: oklch(0.7 0.17 55);
  --accent-bg: oklch(0.96 0.05 60);

  --skeleton: #e5e9ef;
  --skeleton-hi: #f6f8fa;

  --radius: 10px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 6px 20px -4px rgb(0 0 0 / 0.08), 0 2px 6px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 24px 60px -14px rgb(0 0 0 / 0.2);

  --ff: "Inter", ui-sans-serif, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-inout: cubic-bezier(0.77, 0, 0.175, 1);
}

html.dark {
  --bg: oklch(0.16 0 0);
  --fg: oklch(0.96 0 0);
  --card: oklch(0.205 0 0);
  --muted: oklch(0.25 0 0);
  --muted-2: oklch(0.28 0 0);
  --muted-fg: oklch(0.7 0 0);
  --primary: oklch(0.93 0 0);
  --primary-fg: oklch(0.2 0 0);
  --border: oklch(1 0 0 / 0.1);
  --border-strong: oklch(1 0 0 / 0.18);
  --sidebar: oklch(0.18 0 0);
  --success: oklch(0.75 0.14 152);
  --success-bg: oklch(0.32 0.06 152);
  --warn: oklch(0.8 0.13 80);
  --warn-bg: oklch(0.33 0.06 80);
  --danger: oklch(0.72 0.17 25);
  --danger-bg: oklch(0.33 0.07 25);
  --info: oklch(0.75 0.12 250);
  --info-bg: oklch(0.32 0.06 250);
  --violet: oklch(0.76 0.13 300);
  --violet-bg: oklch(0.32 0.07 300);
  --accent-bg: oklch(0.34 0.07 55);
  --skeleton: #2a2f38;
  --skeleton-hi: #353b46;
  --shadow-lg: 0 24px 60px -14px rgb(0 0 0 / 0.6);
}

/* glass: transparent grounds and see-through panels, for a widget laid
   over a coloured band (?glass=1, usually with ?theme=dark). */
html.glass.dark {
  --bg: transparent;
  --card: rgb(255 255 255 / 0.06);
  --muted: rgb(255 255 255 / 0.08);
  --muted-2: rgb(255 255 255 / 0.1);
  --sidebar: transparent;
  --shadow-sm: none;
  --shadow-md: 0 10px 30px -12px rgb(0 0 0 / 0.35);
}
html.glass, html.glass body, html.glass .canvas { background: transparent; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--ff);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.012em; }
p { margin: 0; }

/* ---- canvas ---------------------------------------------------------- */
.canvas {
  position: absolute;
  left: 0; top: 0;
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--bg);
}

/* ---- text helpers ---------------------------------------------------- */
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted-fg); }
.xs { font-size: 12px; }
.sm { font-size: 13px; }
.strong { font-weight: 600; }
.upper { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-fg); }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.sk { display: inline-block; height: 9px; border-radius: 5px; background: var(--skeleton); vertical-align: middle; }

/* ---- icons (kit.js fills <i data-i="name">) --------------------------- */
i[data-i] { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; font-style: normal; }
i[data-i] svg { width: 100%; height: 100%; }

/* ---- primitives ------------------------------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.pad { padding: 18px 20px; }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.panel-head h3 { font-size: 15px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--muted-fg); background: var(--muted);
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge.success { color: var(--success); background: var(--success-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.violet { color: var(--violet); background: var(--violet-bg); }
.badge.accent { color: oklch(0.5 0.15 50); background: var(--accent-bg); }
html.dark .badge.accent { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--ff);
  height: 38px; padding: 0 16px;
  border-radius: 8px; border: 1px solid transparent;
  background: var(--primary); color: var(--primary-fg);
  white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, opacity 200ms ease;
}
.btn.outline { background: var(--card); color: var(--fg); border-color: var(--border); }
.btn.ghost { background: var(--muted); color: var(--fg); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.press { transform: scale(0.97); }

.input {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); font-size: 14px; color: var(--fg);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.input.focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring), transparent 75%); }
.input .ph { color: var(--muted-fg); }
.label { font-size: 13px; font-weight: 500; margin-bottom: 6px; display: block; }

/* blinking caret for typed text: <span class="caret"></span> */
.caret { display: inline-block; width: 1.5px; height: 1.1em; background: var(--fg); vertical-align: -0.15em; margin-left: 1px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.switch {
  width: 36px; height: 20px; border-radius: 999px; flex: none;
  background: var(--muted-2); position: relative;
  transition: background-color 220ms ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 999px; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: transform 220ms var(--ease-out);
}
.switch.on { background: var(--success); }
.switch.on::after { transform: translateX(16px); }

.radio { width: 18px; height: 18px; border-radius: 999px; border: 1.5px solid var(--border-strong); flex: none; position: relative; transition: border-color 200ms ease; }
.radio::after { content: ""; position: absolute; inset: 3px; border-radius: 999px; background: var(--primary); transform: scale(0); transition: transform 200ms var(--ease-out); }
.radio.on { border-color: var(--primary); }
.radio.on::after { transform: scale(1); }

.check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); flex: none; display: grid; place-items: center; transition: background-color 180ms ease, border-color 180ms ease; }
.check.on { background: var(--primary); border-color: var(--primary); }
.check.on::after { content: ""; width: 5px; height: 9px; border: solid var(--primary-fg); border-width: 0 2px 2px 0; transform: translate(0, -1px) rotate(45deg); }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 0; font-size: 14px; font-weight: 500; color: var(--muted-fg); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--fg); border-color: var(--fg); }

.seg { display: inline-flex; padding: 3px; background: var(--muted); border-radius: 8px; gap: 2px; }
.seg span { font-size: 13px; font-weight: 500; padding: 5px 11px; border-radius: 6px; color: var(--muted-fg); }
.seg span.on { background: var(--card); color: var(--fg); box-shadow: var(--shadow-sm); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; background: var(--muted); color: var(--fg); border: 1px solid transparent; white-space: nowrap; }
.chip.on { background: var(--primary); color: var(--primary-fg); }

.avatar { width: 32px; height: 32px; border-radius: 999px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted-fg); background: var(--muted-2); }

.progress { height: 6px; border-radius: 999px; background: var(--muted-2); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width 500ms var(--ease-out); }
.progress.success > span { background: var(--success); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-fg); padding: 10px 20px; border-bottom: 1px solid var(--border); background: color-mix(in oklch, var(--muted), transparent 50%); }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }

.divider { height: 1px; background: var(--border); }

/* toast (dark snackbar) */
.toast {
  display: flex; align-items: center; gap: 12px;
  background: oklch(0.2 0 0); color: oklch(0.97 0 0);
  border: 1px solid oklch(1 0 0 / 0.1); border-radius: 12px;
  padding: 12px 16px; box-shadow: var(--shadow-lg);
  font-size: 14px;
}
html.dark .toast { background: oklch(0.3 0 0); }
.toast .ic { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; background: oklch(0.58 0.14 152); color: #fff; flex: none; }
.toast .ic i[data-i] { width: 14px; height: 14px; }
.toast .sub { font-size: 12px; color: oklch(0.72 0 0); }

/* lo-fi product art (no photography) */
.lofi { position: relative; overflow: hidden; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--skeleton), color-mix(in oklch, var(--skeleton), var(--card) 60%)); flex: none; }
.lofi i[data-i] { width: 42%; height: 42%; color: var(--muted-fg); opacity: 0.4; }

/* enter / leave helpers driven by kit.js toggling .in */
.fx { opacity: 0; transform: translateY(8px); transition: opacity 360ms var(--ease-out), transform 360ms var(--ease-out); }
.fx.in { opacity: 1; transform: none; }
.fx-l { opacity: 0; transform: translateX(-14px); transition: opacity 360ms var(--ease-out), transform 360ms var(--ease-out); }
.fx-l.in { opacity: 1; transform: none; }
.fx-s { opacity: 0; transform: scale(0.96); transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out); }
.fx-s.in { opacity: 1; transform: none; }
.flash { animation: flash 1200ms ease-out; }
@keyframes flash { 0% { background-color: var(--accent-bg); } 100% { background-color: transparent; } }
.pop { animation: pop 360ms var(--ease-out); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* fake pointer, moved by K.point(el) */
.cursor {
  position: absolute; left: 0; top: 0; z-index: 90; width: 30px; height: 30px; margin: -4px 0 0 -6px;
  pointer-events: none; transition: transform 700ms var(--ease-inout), opacity 200ms ease;
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.25));
}
.cursor svg { width: 100%; height: 100%; }
.cursor.click::after { content: ""; position: absolute; left: -9px; top: -9px; width: 22px; height: 22px; border-radius: 999px; background: color-mix(in oklch, var(--fg), transparent 80%); animation: ripple 420ms ease-out forwards; }
@keyframes ripple { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

/* =========================================================================
   Admin shell: <div class="app"><aside class="side">...</aside><main class="main">
   ========================================================================= */
.app { position: absolute; inset: 0; display: grid; grid-template-columns: 220px 1fr; background: var(--bg); }
.side { background: var(--sidebar); border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 6px; font-weight: 600; font-size: 15px; }
.side .brand .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.side .group { display: flex; flex-direction: column; gap: 1px; }
.side .glabel { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-fg); padding: 6px 10px 4px; }
.side .item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; font-size: 14px; font-weight: 500; color: var(--muted-fg); }
.side .item i[data-i] { width: 16px; height: 16px; }
.side .item.on { background: var(--muted); color: var(--fg); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { height: 58px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 28px; border-bottom: 1px solid var(--border); background: var(--card); }
.top .crumbs { font-size: 14px; color: var(--muted-fg); display: flex; align-items: center; gap: 8px; }
.top .crumbs b { color: var(--fg); font-weight: 600; }
.top .search { margin-left: auto; width: 240px; height: 34px; border-radius: 8px; background: var(--muted); display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted-fg); font-size: 13px; }
.top .search i[data-i] { width: 14px; height: 14px; }
.body { flex: 1; min-height: 0; overflow: hidden; padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.pagehead { display: flex; align-items: flex-end; gap: 12px; }
.pagehead h2 { font-size: 22px; }
.pagehead .sub { font-size: 13px; color: var(--muted-fg); margin-top: 4px; }
.pagehead .actions { margin-left: auto; display: flex; gap: 8px; }

/* =========================================================================
   Storefront shell
   ========================================================================= */
.store { position: absolute; inset: 0; background: var(--card); display: flex; flex-direction: column; }
.store-nav { height: 64px; flex: none; display: flex; align-items: center; gap: 28px; padding: 0 40px; border-bottom: 1px solid var(--border); }
.store-nav .logo { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.store-nav .links { display: flex; gap: 22px; font-size: 14px; color: var(--muted-fg); }
.store-nav .icons { margin-left: auto; display: flex; gap: 18px; align-items: center; color: var(--fg); }
.cart-count { position: absolute; top: -6px; right: -8px; min-width: 17px; height: 17px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }

/* =========================================================================
   Diagram primitives
   ========================================================================= */
.node {
  position: absolute; display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 18px; box-shadow: var(--shadow-md);
  transition: border-color 300ms ease, box-shadow 300ms ease, background-color 300ms ease;
}
.node .ni { width: 40px; height: 40px; border-radius: 10px; background: var(--muted); display: grid; place-items: center; color: var(--fg); flex: none; transition: background-color 300ms ease, color 300ms ease; }
.node .ni i[data-i] { width: 20px; height: 20px; }
.node .nt { font-weight: 600; font-size: 16px; }
.node .ns { font-size: 13px; color: var(--muted-fg); }
.node.on { border-color: var(--success); box-shadow: 0 0 0 4px var(--success-bg), var(--shadow-md); }
.node.on .ni { background: var(--success); color: #fff; }
.node.fail { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg), var(--shadow-md); }
.node.fail .ni { background: var(--danger); color: #fff; }
.node.back { border-color: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg), var(--shadow-md); }
.node.back .ni { background: var(--warn); color: #fff; }
.node.hub { border-width: 1.5px; border-color: var(--fg); }
svg.wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
svg.wires path, svg.wires line { fill: none; stroke: var(--border-strong); stroke-width: 2; }
svg.wires .dash { stroke-dasharray: 6 8; animation: dash 1.2s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -28; } }
.packet { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 5px color-mix(in oklch, var(--accent), transparent 75%); opacity: 0; z-index: 5; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* lit diagram nodes: dark glyph on the light status fill reads better in dark mode */
html.dark .node.on .ni, html.dark .node.fail .ni, html.dark .node.back .ni { color: oklch(0.18 0 0); }
