/* Huebic — dark workspace UI. Panels, fields and sliders modelled on pro image-editor tool palettes. */
:root {
  color-scheme: dark;
  --bg: #161617;
  --bg-2: #1c1c1e;
  --panel: #232325;
  --panel-2: #2a2a2d;
  --head: #2e2e31;
  --field: #18181a;
  --line: #0c0c0d;
  --line-2: #3a3a3e;
  --hi: rgba(255, 255, 255, .055);
  --text: #dcdcde;
  --text-2: #a3a3a8;
  --text-3: #6f6f75;
  --accent: #2d8ceb;
  --accent-2: #5aa7f2;
  --ok: #4cc38a;
  --warn: #f2b33d;
  --bad: #ef5a5a;
  --r: 4px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --checker: repeating-conic-gradient(#3a3a3a 0 25%, #2a2a2a 0 50%) 0 0 / 10px 10px;
  --fg-color: #2d8ceb;
  --bg-color: #ffffff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
body::before {   /* faint pixel grid on the workspace */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(45, 140, 235, .07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(235, 45, 140, .05), transparent 60%),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 24px 24px;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #8cc3f7; }
::selection { background: rgba(45, 140, 235, .45); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; color: #f0f0f2; }
code, .mono, kbd { font-family: var(--mono); font-size: 12px; }
kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; background: var(--panel-2); color: var(--text); font-size: 10.5px; line-height: 16px; }
img, canvas, svg { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50; height: 44px; display: flex; align-items: center; gap: 4px;
  padding: 0 10px 0 12px; background: rgba(30, 30, 32, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); box-shadow: inset 0 -1px 0 var(--hi), 0 6px 20px rgba(0,0,0,.25);
}
.brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 650; font-size: 15px; letter-spacing: -.02em; padding-right: 10px; margin-right: 4px; border-right: 1px solid var(--line-2); height: 26px; }
.brand:hover { color: #fff; }
.brand svg { width: 24px; height: 24px; transition: transform .5s cubic-bezier(.3,1.6,.5,1); }
.brand:hover svg { transform: rotate(60deg); }
.brand sup { font-size: 9px; color: var(--text-3); font-weight: 500; margin-left: -5px; letter-spacing: .04em; }
.menu { display: flex; align-items: center; gap: 1px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.menu::-webkit-scrollbar { display: none; }
.menu a { color: var(--text-2); padding: 4px 9px; border-radius: 3px; white-space: nowrap; font-size: 12.5px; position: relative; }
.menu a:hover { background: rgba(255,255,255,.06); color: var(--text); }
.menu a[aria-current="page"] { color: #fff; background: rgba(45,140,235,.16); box-shadow: inset 0 0 0 1px rgba(45,140,235,.35); }
.chips { display: flex; align-items: center; gap: 10px; margin-left: 6px; }
.fgbg { position: relative; width: 38px; height: 30px; flex: none; }
.fgbg .sw { position: absolute; width: 20px; height: 20px; border: 1px solid #000; box-shadow: inset 0 0 0 1px rgba(255,255,255,.75); cursor: pointer; padding: 0; }
.fgbg .sw.fg { left: 0; top: 0; z-index: 2; background: var(--fg-color); }
.fgbg .sw.bgc { left: 11px; top: 9px; background: var(--bg-color); }
.fgbg .swap, .fgbg .def { position: absolute; background: none; border: 0; padding: 0; color: var(--text-2); cursor: pointer; }
.fgbg .swap { right: -7px; top: -3px; width: 13px; height: 13px; }
.fgbg .def { left: -2px; bottom: -3px; width: 11px; height: 11px; }
.fgbg .swap:hover, .fgbg .def:hover { color: #fff; }
.fgbg svg { width: 100%; height: 100%; }
.fghex { font: 11px var(--mono); color: var(--text-2); min-width: 54px; }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 22px 20px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 6px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; display: flex; align-items: center; gap: 10px; }
.page-head h1 .ico { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.page-head p { margin: 4px 0 0; color: var(--text-2); max-width: 720px; }
.crumbs { font-size: 11px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 11.5px; }
@media (max-width: 980px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); } main { padding: 16px 16px 40px; } }

/* ---------- panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: inset 0 1px 0 var(--hi), 0 1px 0 rgba(255,255,255,.02), 0 10px 30px -12px rgba(0,0,0,.6);
  min-width: 0; position: relative;
}
.panel-head {
  height: 28px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 8px;
  background: linear-gradient(#323236, #2b2b2e); border-bottom: 1px solid var(--line);
  border-radius: var(--r) var(--r) 0 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  font-size: 11.5px; color: var(--text); user-select: none; overflow: hidden;
}
.panel-head::before {  /* grip */
  content: ""; width: 6px; height: 10px; flex: none; opacity: .5;
  background: radial-gradient(circle, #8a8a90 1px, transparent 1.3px) 0 0 / 3px 3px;
}
.panel-head .title { font-weight: 600; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-head .meta { margin-left: auto; color: var(--text-3); font: 10.5px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.panel-head .menu-btn { margin-left: 2px; width: 18px; height: 18px; display: grid; place-items: center; color: var(--text-3); border-radius: 2px; }
.tabs { display: flex; align-self: stretch; margin-left: -2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; color: var(--text-2); font: inherit; font-size: 11.5px; padding: 0 10px; cursor: pointer;
  border-right: 1px solid var(--line); position: relative;
}
.tabs button:first-child { border-left: 1px solid var(--line); }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--panel); color: #fff; box-shadow: inset 0 2px 0 var(--accent); margin-bottom: -1px; }
.panel-body { padding: 12px; }
.panel-body.tight { padding: 8px; }
.panel-foot { border-top: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--hi); padding: 6px 10px; display: flex; gap: 8px; align-items: center; color: var(--text-3); font-size: 11px; }
.sep { height: 1px; background: var(--line); box-shadow: 0 1px 0 var(--hi); margin: 10px 0; border: 0; }
.label { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* ---------- controls ---------- */
.btn {
  height: 24px; padding: 0 10px; border-radius: 3px; border: 1px solid #0a0a0b; cursor: pointer;
  background: linear-gradient(#3c3c40, #333337); color: var(--text); font: 12px var(--font);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: linear-gradient(#44444a, #3a3a3f); color: #fff; }
.btn:active { background: #2c2c30; box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.btn.primary { background: linear-gradient(#3595f0, #2780d8); border-color: #13497f; color: #fff; }
.btn.primary:hover { background: linear-gradient(#45a0f3, #2d8ceb); }
.btn.icon { width: 24px; padding: 0; justify-content: center; }
.btn svg { width: 14px; height: 14px; }
.btn.sm { height: 20px; font-size: 11px; padding: 0 7px; }
.input, select.input {
  height: 22px; background: var(--field); border: 1px solid var(--line); border-radius: 2px; color: #ececee;
  font: 12px var(--mono); padding: 0 6px; box-shadow: inset 0 1px 2px rgba(0,0,0,.5), 0 1px 0 var(--hi); min-width: 0;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.input.big { height: 34px; font-size: 15px; padding: 0 10px; }
select.input { font-family: var(--font); padding-right: 18px; appearance: none; cursor: pointer;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0h8L4 5z' fill='%23999'/%3E%3C/svg%3E") no-repeat right 6px center; }
.field { display: grid; grid-template-columns: 22px 1fr 18px; align-items: center; gap: 4px; }
.field > label, .scrub { color: var(--text-2); font-size: 11.5px; cursor: ew-resize; user-select: none; }
.field .unit { color: var(--text-3); font-size: 11px; }
.field .input { width: 100%; text-align: right; }
.radio { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 12px; color: var(--text-2); }
.radio input, .check input, input.cb { appearance: none; margin: 0; width: 12px; height: 12px; border: 1px solid #0a0a0b; background: var(--field); box-shadow: inset 0 1px 2px rgba(0,0,0,.6), 0 1px 0 var(--hi); cursor: pointer; flex: none; }
.radio input { border-radius: 50%; }
.radio input:checked { background: radial-gradient(circle, #fff 0 2px, var(--accent) 2.5px); border-color: #13497f; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: var(--text-2); user-select: none; }
.check input, input.cb { border-radius: 2px; }
.check input:checked, input.cb:checked { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' stroke='white' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") center/10px no-repeat; border-color: #13497f; }
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; background: var(--field); box-shadow: 0 1px 0 var(--hi); }
.seg button { background: none; border: 0; border-right: 1px solid var(--line); color: var(--text-2); font: 11.5px var(--font); padding: 0 9px; height: 22px; cursor: pointer; white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: #fff; background: rgba(255,255,255,.04); }
.seg button[aria-pressed="true"] { background: linear-gradient(#3a3a3f, #303034); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }

/* channel slider with triangular thumb */
.cslider { position: relative; height: 22px; touch-action: none; cursor: pointer; outline: none; }
.cslider .track { position: absolute; left: 4px; right: 4px; top: 3px; height: 10px; border: 1px solid #000; box-shadow: 0 0 0 1px rgba(255,255,255,.08); background-clip: padding-box; }
.cslider .track.alpha::before { content: ""; position: absolute; inset: 0; background: var(--checker); background-size: 6px 6px; z-index: -1; }
.cslider .thumb { position: absolute; top: 13px; width: 0; height: 0; margin-left: -5px; border: 5px solid transparent; border-bottom: 7px solid #e6e6e6; border-top: 0; filter: drop-shadow(0 1px 0 #000); transition: border-color .1s; }
.cslider:focus-visible .thumb, .cslider:hover .thumb { border-bottom-color: #fff; }
.cslider:focus-visible .track { box-shadow: 0 0 0 1px var(--accent); }
.crow { display: grid; grid-template-columns: 20px 1fr 52px; gap: 6px; align-items: center; }
.crow .input { text-align: right; width: 100%; }

/* swatches */
.swatch { border: 1px solid #000; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); border-radius: 2px; position: relative; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(18px, 1fr)); gap: 3px; }
.swatches button { aspect-ratio: 1; border: 1px solid #000; padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); border-radius: 1px; }
.swatches button:hover { outline: 1px solid #fff; z-index: 1; }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: 9px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; background: rgba(255,255,255,.07); color: var(--text-2); white-space: nowrap; }
.chip.ok { background: rgba(76,195,138,.14); color: var(--ok); }
.chip.bad { background: rgba(239,90,90,.14); color: var(--bad); }
.chip.warn { background: rgba(242,179,61,.14); color: var(--warn); }
.chip.info { background: rgba(45,140,235,.16); color: var(--accent-2); }

.copy { cursor: pointer; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-family: var(--mono); color: var(--text); text-align: right; }
.readout { font: 11px var(--mono); color: var(--text-2); background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 2px; padding: 4px 7px; box-shadow: 0 1px 0 var(--hi); }

/* canvases */
.cv { width: 100%; height: auto; border: 1px solid #000; box-shadow: 0 0 0 1px rgba(255,255,255,.06); background: #0e0e10; touch-action: none; image-rendering: auto; }
.cv-wrap { position: relative; }
.cross { position: absolute; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; border: 1px solid #fff; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #000; pointer-events: none; }
.cross.dark { border-color: #000; box-shadow: 0 0 0 1px rgba(255,255,255,.8), inset 0 0 0 1px rgba(255,255,255,.8); }

/* tooltips */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); z-index: 99;
  background: #f2f2f2; color: #111; font: 11px var(--font); padding: 3px 7px; border-radius: 2px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.5); animation: tip .15s .35s both;
}
@keyframes tip { from { opacity: 0; transform: translate(-50%, -2px); } }

.toast { position: fixed; left: 50%; bottom: 46px; transform: translate(-50%, 10px); background: #f2f2f2; color: #111; font-size: 12px; padding: 6px 12px; border-radius: 3px; box-shadow: 0 6px 24px rgba(0,0,0,.5); opacity: 0; transition: .2s; pointer-events: none; z-index: 200; display: flex; gap: 8px; align-items: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast i { width: 12px; height: 12px; border: 1px solid #0003; border-radius: 2px; }

/* ---------- footer / status bar ---------- */
.site-foot { border-top: 1px solid var(--line); background: #1a1a1c; box-shadow: inset 0 1px 0 var(--hi); }
.foot-in { max-width: 1360px; margin: 0 auto; padding: 26px 20px 22px; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 24px; }
.foot-in h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-bottom: 8px; }
.foot-in ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.foot-in a { color: var(--text-2); }
.foot-in a:hover { color: #fff; }
.foot-brand p { color: var(--text-3); max-width: 340px; margin: 8px 0 0; font-size: 12px; }
.foot-spectrum { height: 3px; background: linear-gradient(90deg, #ff0040, #ff8000, #ffe000, #40ff00, #00ffc0, #0080ff, #4000ff, #ff00c0, #ff0040); opacity: .8; }
.statusbar { height: 26px; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: #121213; border-top: 1px solid #000; color: var(--text-3); font: 11px var(--mono); }
.statusbar .mail { margin-left: auto; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.statusbar .mail:hover { color: #fff; }
.statusbar .mail svg { width: 13px; height: 13px; }
.statusbar .dot { width: 9px; height: 9px; border: 1px solid #000; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); background: var(--fg-color); }
@media (max-width: 820px) {
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .statusbar .hide-s { display: none; }
  .fghex { display: none; }
}
@media (max-width: 560px) {
  .brand span.word { display: none; }
  .brand { padding-right: 6px; }
}

/* ---------- prose ---------- */
.prose { max-width: 760px; font-size: 15px; line-height: 1.7; color: #cfcfd3; }
.prose h2 { font-size: 22px; margin: 44px 0 12px; scroll-margin-top: 60px; }
.prose h3 { font-size: 16px; margin: 28px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose .formula { font: 13px/1.7 var(--mono); background: #121214; border: 1px solid var(--line); border-left: 2px solid var(--accent); padding: 10px 14px; border-radius: 2px; overflow-x: auto; color: #e6e6e8; margin: 14px 0; white-space: pre; }
.prose figure { margin: 18px 0 22px; }
.prose figcaption { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose em { color: #fff; font-style: normal; font-weight: 500; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
