/* Haelyx shell — the one header, switcher, footer and state set every surface shares.
 *
 * Everything here is namespaced `hx-` so it can sit on top of a page's own CSS
 * (engine.css, the DocSpeaks style block, the homepage's inline styles) without
 * colliding with it. Load it BEFORE the page stylesheet.
 *
 * Light mode is opt-in: add class="hx-theme-aware" to <html> on a surface that
 * ships a theme toggle (DocSpeaks). Everywhere else the shell stays night-dark
 * so the product reads as one thing.
 */

:root {
  --hx-night: #0a0f2c;
  --hx-night-2: #0d1535;
  --hx-teal: #00e5c8;
  --hx-teal-deep: #009b87;
  --hx-parchment: #f5f2ec;

  --hx-bg: var(--hx-night);
  --hx-bg-2: var(--hx-night-2);
  --hx-card: rgba(19, 28, 66, .72);
  --hx-well: rgba(5, 9, 30, .55);
  --hx-ink: #f4f6f8;
  --hx-ink-2: rgba(244, 246, 248, .66);
  --hx-ink-3: rgba(244, 246, 248, .42);
  --hx-rule: rgba(244, 246, 248, .1);
  --hx-rule-2: rgba(244, 246, 248, .18);
  --hx-accent: var(--hx-teal);
  --hx-accent-ink: var(--hx-night);
  --hx-accent-soft: rgba(0, 229, 200, .1);
  --hx-warn: #ffb547;
  --hx-danger: #ff5d73;

  --hx-sans: "Plus Jakarta Sans", system-ui, sans-serif;
  --hx-serif: "Source Serif 4", Georgia, serif;
  --hx-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --hx-max: 1120px;
  --hx-r: 14px;
  --hx-ease: cubic-bezier(.16, 1, .3, 1);
  --hx-shadow: 0 30px 80px -40px rgba(0, 0, 0, .7);
}

@media (prefers-color-scheme: light) {
  html.hx-theme-aware:not([data-theme="dark"]) {
    --hx-bg: var(--hx-parchment); --hx-bg-2: #ece7dd; --hx-card: #fffdf8; --hx-well: #f8f5ee;
    --hx-ink: #0a0f2c; --hx-ink-2: rgba(10, 15, 44, .7); --hx-ink-3: rgba(10, 15, 44, .48);
    --hx-rule: rgba(10, 15, 44, .1); --hx-rule-2: rgba(10, 15, 44, .2);
    --hx-accent: var(--hx-teal-deep); --hx-accent-ink: #fff; --hx-accent-soft: rgba(0, 155, 135, .1);
    --hx-shadow: 0 30px 70px -45px rgba(10, 15, 44, .35);
  }
}
html.hx-theme-aware[data-theme="light"] {
  --hx-bg: var(--hx-parchment); --hx-bg-2: #ece7dd; --hx-card: #fffdf8; --hx-well: #f8f5ee;
  --hx-ink: #0a0f2c; --hx-ink-2: rgba(10, 15, 44, .7); --hx-ink-3: rgba(10, 15, 44, .48);
  --hx-rule: rgba(10, 15, 44, .1); --hx-rule-2: rgba(10, 15, 44, .2);
  --hx-accent: var(--hx-teal-deep); --hx-accent-ink: #fff; --hx-accent-soft: rgba(0, 155, 135, .1);
  --hx-shadow: 0 30px 70px -45px rgba(10, 15, 44, .35);
}

/* The hidden attribute must win over every display rule below, because the
   sign-in controls ship hidden and only /api/config may reveal them. */
[hidden] { display: none !important; }

/* Skip link -------------------------------------------------------------- */
.hx-skip { position: absolute; left: 16px; top: -60px; z-index: 60; padding: 10px 14px; border-radius: 8px; background: var(--hx-accent); color: var(--hx-accent-ink); font: 700 13px/1 var(--hx-sans); text-decoration: none; }
.hx-skip:focus { top: 12px; }

/* Top bar ---------------------------------------------------------------- */
.hx-bar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--hx-bg) 84%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-bottom: 1px solid var(--hx-rule); font-family: var(--hx-sans); }
.hx-bar :where(nav, a, button, div) { position: static; }
.hx-bar-in { display: flex; align-items: center; flex-wrap: nowrap; gap: 14px; min-height: 60px; width: min(var(--hx-max), calc(100% - 40px)); margin-inline: auto; }
.hx-brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--hx-ink); flex: none; }
.hx-brand svg { width: 15px; height: 18px; flex: none; color: var(--hx-accent); }
.hx-brand-wm { font-size: 11px; font-weight: 800; letter-spacing: 3.4px; }

/* Product switcher. The status chip next to each product is the honest bit:
   it says what that surface can actually do today, not what is planned. */
.hx-switch { position: relative; flex: none; }
.hx-switch-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 15px; border: 1px solid var(--hx-rule-2); border-radius: 999px; background: color-mix(in srgb, var(--hx-ink) 5%, transparent); color: var(--hx-ink); font: 600 13px/1 var(--hx-sans); letter-spacing: -.01em; cursor: pointer; transition: border-color .18s, background .18s; }
.hx-switch-btn:hover { border-color: var(--hx-accent); }
.hx-switch-btn::after { content: ""; width: 6px; height: 6px; margin-left: 1px; border-right: 1.6px solid var(--hx-ink-3); border-bottom: 1.6px solid var(--hx-ink-3); transform: translateY(-2px) rotate(45deg); }
.hx-switch-btn[aria-expanded="true"]::after { transform: translateY(1px) rotate(225deg); }
.hx-switch-menu { position: absolute; left: 0; top: calc(100% + 8px); width: 310px; max-width: calc(100vw - 32px); padding: 6px; border: 1px solid var(--hx-rule-2); border-radius: var(--hx-r); background: var(--hx-bg-2); box-shadow: var(--hx-shadow); display: none; }
html.hx-theme-aware[data-theme="light"] .hx-switch-menu,
html.hx-theme-aware:not([data-theme="dark"]) .hx-switch-menu { background: var(--hx-card); }
.hx-switch-menu[data-open="true"] { display: block; }
.hx-switch-item { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--hx-ink); }
.hx-switch-item:hover, .hx-switch-item:focus-visible { background: color-mix(in srgb, var(--hx-ink) 7%, transparent); }
.hx-switch-item[aria-current="true"] { background: var(--hx-accent-soft); }
.hx-switch-name { font: 600 13.5px/1.3 var(--hx-sans); letter-spacing: -.01em; }
.hx-switch-note { grid-column: 1; margin: 0; font: 400 11.5px/1.5 var(--hx-sans); color: var(--hx-ink-3); }
.hx-chip { justify-self: end; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--hx-rule-2); font: 500 9.5px/1 var(--hx-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--hx-ink-3); white-space: nowrap; }
.hx-chip[data-tone="live"] { border-color: color-mix(in srgb, var(--hx-accent) 50%, transparent); color: var(--hx-accent); }
.hx-chip[data-tone="soon"] { border-color: color-mix(in srgb, var(--hx-warn) 45%, transparent); color: var(--hx-warn); }

.hx-bar-links { display: flex; align-items: center; gap: 22px; margin-left: auto; font: 500 13px/1 var(--hx-sans); color: var(--hx-ink-2); }
.hx-bar-links a { color: inherit; text-decoration: none; transition: color .18s; }
.hx-bar-links a:hover, .hx-bar-links a[aria-current="page"] { color: var(--hx-accent); }
.hx-bar-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.hx-bar-links + .hx-bar-actions { margin-left: 0; }

/* Buttons ---------------------------------------------------------------- */
.hx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 22px; border: 1px solid var(--hx-rule-2); border-radius: 999px; background: transparent; color: var(--hx-ink); font: 600 13.5px/1 var(--hx-sans); letter-spacing: -.01em; text-decoration: none; white-space: nowrap; cursor: pointer; transition: transform .18s var(--hx-ease), border-color .18s, background .18s; }
.hx-btn:hover { border-color: var(--hx-accent); transform: translateY(-1px); }
.hx-btn:active { transform: none; }
.hx-btn-primary { border-color: transparent; background: var(--hx-accent); color: var(--hx-accent-ink); font-weight: 700; }
.hx-btn-primary:hover { border-color: transparent; filter: brightness(1.06); }
.hx-btn-sm { min-height: 34px; padding: 0 16px; font-size: 12.5px; }
.hx-btn-quiet { border-color: transparent; color: var(--hx-ink-2); }
.hx-btn-quiet:hover { color: var(--hx-accent); }
:where(.hx-bar, .hx-foot, .hx-state, .hx-shell) :focus-visible { outline: 2px solid var(--hx-accent); outline-offset: 3px; border-radius: 6px; }

/* Shared state blocks — empty, loading, error read the same on every surface. */
.hx-state { display: grid; justify-items: center; gap: 10px; max-width: 460px; margin: 44px auto; padding: 34px 26px; border: 1px solid var(--hx-rule); border-radius: var(--hx-r); background: var(--hx-card); text-align: center; font-family: var(--hx-sans); }
.hx-state-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--hx-accent-soft); color: var(--hx-accent); font-size: 16px; }
.hx-state h2, .hx-state h3 { margin: 0; font: 700 17px/1.3 var(--hx-sans); letter-spacing: -.02em; color: var(--hx-ink); }
.hx-state p { margin: 0; font: 400 13.5px/1.65 var(--hx-sans); color: var(--hx-ink-2); }
.hx-state .hx-btn { margin-top: 6px; }
.hx-state[data-tone="error"] { border-color: color-mix(in srgb, var(--hx-danger) 40%, transparent); }
.hx-state[data-tone="error"] .hx-state-mark { background: color-mix(in srgb, var(--hx-danger) 14%, transparent); color: var(--hx-danger); }
.hx-spinner { width: 26px; height: 26px; border: 2px solid var(--hx-rule-2); border-top-color: var(--hx-accent); border-radius: 50%; animation: hx-spin .8s linear infinite; }
@keyframes hx-spin { to { transform: rotate(360deg); } }

/* Inline banner — the error state when a whole block is too much. */
.hx-note { display: block; margin: 0; padding: 12px 14px; border-left: 2px solid var(--hx-accent); border-radius: 0 8px 8px 0; background: var(--hx-accent-soft); font: 400 12.5px/1.65 var(--hx-sans); color: var(--hx-ink-2); }
.hx-note[data-tone="warn"] { border-left-color: var(--hx-warn); background: color-mix(in srgb, var(--hx-warn) 9%, transparent); }

/* Footer ----------------------------------------------------------------- */
.hx-foot { border-top: 1px solid var(--hx-rule); padding: 38px 0 46px; font-family: var(--hx-sans); }
.hx-foot-in { width: min(var(--hx-max), calc(100% - 40px)); margin-inline: auto; display: grid; gap: 26px; }
.hx-foot-cols { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); gap: 26px; }
.hx-foot-cols h2 { margin: 0 0 12px; font: 500 10px/1 var(--hx-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--hx-ink-3); }
.hx-foot-cols a { display: block; margin-bottom: 8px; font-size: 12.5px; color: var(--hx-ink-2); text-decoration: none; }
.hx-foot-cols a:hover { color: var(--hx-accent); }
.hx-foot-tag { max-width: 280px; margin: 10px 0 0; font: 400 12.5px/1.7 var(--hx-sans); color: var(--hx-ink-3); }
.hx-foot-legal { padding-top: 20px; border-top: 1px solid var(--hx-rule); font: 400 11.5px/1.7 var(--hx-sans); color: var(--hx-ink-3); }
.hx-foot-legal strong { color: var(--hx-ink-2); font-weight: 600; }

@media (max-width: 860px) {
  .hx-bar-in { width: calc(100% - 28px); gap: 10px; }
  .hx-bar-links { display: none; }
  .hx-brand-wm { display: none; }
  .hx-foot-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  /* One action in the bar on a phone: the switcher is the navigation. */
  .hx-wide-only { display: none !important; }
  .hx-bar-in { gap: 8px; }
  .hx-switch-btn { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 32px; }
  .hx-switch-btn::after { display: none; }
}
@media (max-width: 560px) {
  .hx-switch-menu { position: fixed; left: 14px; right: 14px; top: 64px; width: auto; max-width: none; }
  .hx-foot-cols { grid-template-columns: 1fr; gap: 20px; }
  .hx-state { margin: 28px auto; padding: 28px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .hx-btn, .hx-switch-btn { transition: none; }
  .hx-spinner { animation-duration: 2.4s; }
}
