/* ============================================================
   HELYX AI — design system
   Direction: precision instrument / field-notes aesthetic.
   Paper canvas, ink type, one signal accent (safety orange),
   mono data labels. Mobile is a first-class layout, not a
   squeezed desktop.
   ============================================================ */

:root {
  --paper: #f4f1ea;
  --paper-2: #ebe7dd;
  --card: #fbfaf6;
  --ink: #17150f;
  --ink-2: #3c382e;
  --ink-3: #6f6a5c;
  --line: #d8d2c4;
  --line-2: #c4bcab;
  --signal: #ff4d00;
  --signal-ink: #b03400;
  --signal-soft: #ffe3d2;
  --volt: #0d8a4a;
  --volt-soft: #d9f2e2;
  --amber: #b7791f;
  --amber-soft: #f7ecd2;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --radius: 6px;
  --shadow-1: 0 1px 0 rgba(23,21,15,.06);
  --shadow-2: 0 10px 30px -18px rgba(23,21,15,.35);
  --gut: 28px;          /* page gutter, shrinks on mobile */
  --tap: 44px;          /* minimum touch target */
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; }
img, svg, video { max-width: 100%; height: auto; }
::selection { background: var(--signal); color: #fff; }

/* iOS zooms any input under 16px on focus — keep form text at 16px on small screens */
input, select, textarea, button { font-family: inherit; }

/* ---------- type ---------- */
.hx-display {
  font-family: var(--serif);
  font-weight: 560;
  font-variation-settings: "opsz" 72;
  letter-spacing: -0.02em;
  line-height: 1.04;
  overflow-wrap: break-word;
}
.hx-display em { font-style: italic; color: var(--signal); }

.hx-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.hx-mono { font-family: var(--mono); }
.hx-hide-sm { display: initial; }

/* ---------- layout ---------- */
.hx-shell { max-width: 1180px; margin: 0 auto; padding: 0 var(--gut); }
.hx-section { padding: 72px 0; border-top: 1px solid var(--line); }
.hx-section--tight { padding: 48px 0; }

.hx-grid { display: grid; gap: 28px; }
.hx-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hx-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hx-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- status bar ---------- */
.hx-topbar {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 0;
}
.hx-topbar .hx-shell {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.hx-topbar .pulse { color: var(--signal); }
.hx-topbar .hide-sm { opacity: .75; }

/* ---------- nav ---------- */
.hx-nav {
  position: sticky; top: 0; z-index: 60;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}
.hx-nav .hx-shell { display: flex; align-items: center; gap: 24px; height: 64px; }
.hx-brand {
  font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: -.02em;
  display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink);
  white-space: nowrap;
}
.hx-brand .dot { width: 9px; height: 9px; background: var(--signal); display: inline-block; }
.hx-brand .ver { font-family: var(--mono); font-size: 10px; color: var(--ink-3); letter-spacing: .1em; }

.hx-navlinks { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.hx-navlinks a {
  font-family: var(--mono); font-size: 12.5px; text-decoration: none; color: var(--ink-2);
  padding: 8px 11px; border-radius: var(--radius); white-space: nowrap;
}
.hx-navlinks a:hover { color: var(--ink); background: var(--paper-2); }
.hx-navlinks a.here { color: var(--ink); background: var(--paper-2); box-shadow: inset 0 -2px 0 var(--signal); }

.hx-cta {
  font-family: var(--mono); font-size: 12.5px; text-decoration: none;
  background: var(--ink); color: var(--paper);
  padding: 9px 16px; border-radius: var(--radius);
  border: 1px solid var(--ink);
  transition: background .15s, color .15s, transform .1s;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.hx-cta:hover { background: var(--signal); border-color: var(--signal); color: #fff; transform: translateY(-1px); }
.hx-cta--ghost { background: transparent; color: var(--ink); }
.hx-cta--ghost:hover { background: var(--ink); color: var(--paper); }

/* mobile drawer */
.hx-burger {
  display: none; margin-left: auto;
  width: var(--tap); height: var(--tap);
  align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line-2); border-radius: var(--radius);
  cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink);
}
.hx-mmenu {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--paper);
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.hx-mmenu.open { display: block; }
.hx-mmenu a {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--tap);
  padding: 13px var(--gut);
  text-decoration: none;
  font-family: var(--mono); font-size: 14px; color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.hx-mmenu a:active { background: var(--paper-2); }
.hx-mmenu a.here { color: var(--ink); background: var(--paper-2); box-shadow: inset 3px 0 0 var(--signal); }
.hx-mmenu .mm-cta {
  background: var(--ink); color: var(--paper); border-bottom: none;
  justify-content: center; font-size: 14px;
}
.hx-mmenu .mm-group {
  padding: 14px var(--gut) 6px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
  background: var(--paper-2); border-bottom: 1px solid var(--line);
}

/* ---------- buttons ---------- */
.hx-btn {
  font-family: var(--mono); font-size: 13px; letter-spacing: .02em; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: var(--tap);
  padding: 12px 22px; border-radius: var(--radius);
  background: var(--signal); color: #fff; border: 1px solid var(--signal);
  cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s;
}
.hx-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.hx-btn:active { transform: translateY(0); }
.hx-btn--ink { background: var(--ink); border-color: var(--ink); }
.hx-btn--ink:hover { background: #000; }
.hx-btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.hx-btn--ghost:hover { border-color: var(--ink); }
.hx-btn--wa { background: #25D366; border-color: #1eb85a; color: #06331a; }
.hx-btn--tg { background: #229ED9; border-color: #1b86b8; color: #04222e; }
.hx-btn--block { width: 100%; }

/* ---------- panels ---------- */
.hx-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.hx-panel--flush { box-shadow: none; }
.hx-rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---------- tables ---------- */
.hx-tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.hx-tablewrap::-webkit-scrollbar { height: 6px; }
.hx-tablewrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }

.hx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hx-table th {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-3); text-align: left; padding: 12px 16px;
  border-bottom: 1px solid var(--ink); background: var(--paper-2);
  white-space: nowrap;
}
.hx-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.hx-table tr:last-child td { border-bottom: none; }
.hx-table tbody tr:hover { background: var(--paper); }

/* Card-per-row table on small screens: set data-label on each td */
@media (max-width: 720px) {
  .hx-table--cards thead { display: none; }
  .hx-table--cards, .hx-table--cards tbody, .hx-table--cards tr, .hx-table--cards td { display: block; width: 100%; }
  .hx-table--cards tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    margin-bottom: 12px; background: var(--card); padding: 6px 0;
  }
  .hx-table--cards td {
    border-bottom: 1px dashed var(--line);
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 10px 14px; text-align: right;
  }
  .hx-table--cards td:last-child { border-bottom: none; }
  .hx-table--cards td::before {
    content: attr(data-label);
    font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-3); text-align: left; flex: 0 0 auto;
  }
}

/* ---------- badges ---------- */
.hx-badge {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2);
  background: var(--paper-2); white-space: nowrap; display: inline-block;
}
.hx-badge--signal { background: var(--signal); border-color: var(--signal); color: #fff; }
.hx-badge--volt { background: var(--volt-soft); border-color: #a8d8b8; color: var(--volt); }
.hx-badge--amber { background: var(--amber-soft); border-color: #e2cf9e; color: var(--amber); }

/* ---------- code ---------- */
.hx-code {
  font-family: var(--mono); font-size: 13px; background: var(--ink); color: #e9e4d8;
  padding: 16px; border-radius: var(--radius); overflow-x: auto; line-height: 1.6;
  -webkit-overflow-scrolling: touch; white-space: pre;
}
.hx-code .c { color: #8b8577; }
.hx-code .k { color: var(--signal); }
.hx-code .s { color: #9ed9a8; }
.hx-code .f { color: #a9c9ff; }

.hx-inlinecode {
  font-family: var(--mono); font-size: .85em; background: var(--paper-2); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 4px; overflow-wrap: break-word;
}

/* ---------- forms ---------- */
.hx-input, .hx-select {
  font-family: var(--mono); font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 12px 14px; outline: none; width: 100%; min-height: var(--tap);
  -webkit-appearance: none; appearance: none;
}
.hx-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236f6a5c' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px;
}
.hx-input:focus, .hx-select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255,77,0,.12); }
.hx-field label { display: block; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 7px; }

/* ---------- bits ---------- */
.hx-tick { display: flex; gap: 12px; align-items: flex-start; }
.hx-tick .t { font-family: var(--mono); color: var(--signal); font-size: 15px; line-height: 1.3; flex: 0 0 auto; }

.hx-stat b { font-family: var(--serif); font-size: 34px; font-weight: 560; letter-spacing: -.02em; display: block; line-height: 1; }
.hx-stat span { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }

.progress { height: 8px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--signal); }

.term { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); display: block; }
.term::before { content: "// "; color: var(--signal); }

.flash {
  border: 1px solid #a8d8b8; background: var(--volt-soft); color: var(--volt);
  padding: 13px 16px; border-radius: var(--radius); font-size: 13.5px;
  margin-bottom: 22px; font-family: var(--mono); overflow-wrap: break-word;
}
.flash.bad { border-color: #e2b9a8; background: var(--signal-soft); color: var(--signal-ink); }

.hidden { display: none !important; }

/* Floating contact dock (replaces the old support widget) */
.hx-dock {
  position: fixed; right: 16px; bottom: 16px; z-index: 70;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.hx-dock a {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 20px;
  box-shadow: 0 6px 18px -6px rgba(23,21,15,.5);
  transition: transform .15s;
}
.hx-dock a:hover { transform: scale(1.06); }
.hx-dock .wa { background: #25D366; color: #06331a; }
.hx-dock .tg { background: #229ED9; color: #fff; }

/* ---------- footer ---------- */
.hx-footer { border-top: 1px solid var(--ink); background: var(--ink); color: var(--paper); margin-top: 80px; }
.hx-footer .hx-shell { padding-top: 44px; padding-bottom: 34px; }
.hx-footer a { color: var(--paper); text-decoration: none; }
.hx-footer a:hover { color: var(--signal); }
.hx-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.hx-footer h5 { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: #8b8577; margin: 0 0 14px; }
.hx-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.hx-footer ul a { font-size: 14px; color: #cfc9bb; }
.hx-footer .foot-bottom {
  border-top: 1px solid #2e2a20; margin-top: 36px; padding-top: 22px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; color: #8b8577;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .hx-navlinks a { padding: 8px 9px; font-size: 12px; }
}

@media (max-width: 940px) {
  :root { --gut: 20px; }
  .hx-navlinks { display: none; }
  .hx-burger { display: inline-flex; }
  .hx-grid--3, .hx-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hx-footer .cols { grid-template-columns: 1fr 1fr; }
  .hx-section { padding: 56px 0; }
}

@media (max-width: 700px) {
  :root { --gut: 16px; }
  body { font-size: 15.5px; }
  .hx-grid { gap: 18px; }
  .hx-grid--2, .hx-grid--3, .hx-grid--4 { grid-template-columns: minmax(0, 1fr); }
  .hx-section { padding: 40px 0; }
  .hx-section--tight { padding: 30px 0; }
  .hx-footer { margin-top: 48px; }
  .hx-footer .cols { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .hx-footer .foot-bottom { flex-direction: column; gap: 8px; }
  .hx-nav .hx-shell { height: 58px; gap: 12px; }
  .hx-brand { font-size: 19px; }
  .hx-brand .ver { display: none; }
  .hx-topbar { font-size: 11px; padding: 6px 0; }
  .hx-topbar .hide-sm, .hx-hide-sm { display: none; }
  .hx-btn { width: 100%; }              /* stacked, full-width, thumb-friendly */
  .hx-btn--auto { width: auto; }
  .hx-code { font-size: 11.5px; padding: 13px; border-radius: 5px; }
  .hx-panel { border-radius: 5px; }
  .hx-stat b { font-size: 27px; }
  .hx-table th, .hx-table td { padding: 11px 12px; }
  .hx-dock { right: 12px; bottom: 12px; }
  .hx-dock a { width: 44px; height: 44px; font-size: 18px; }
}

@media (max-width: 400px) {
  .hx-brand { font-size: 17px; }
  .hx-badge { font-size: 9.5px; padding: 3px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
