/* Crystia base: tokens, surfaces, rows and buttons carried over from the Polation site (styles.css). Accent = amethyst. */
@font-face { font-family: "Noto NL"; src: url("../fonts/NotoSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto NL"; src: url("../fonts/NotoSans-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Noto NL"; src: url("../fonts/NotoSans-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

/* Registered colour properties so the whole palette tweens like "##palette_theme_blend" (0.3s OutCubic). */
@property --label        { syntax: "<color>"; inherits: true; initial-value: #d6d6db; }
@property --muted        { syntax: "<color>"; inherits: true; initial-value: #73737dc8; }
@property --text         { syntax: "<color>"; inherits: true; initial-value: #f2f2f2; }
@property --caption      { syntax: "<color>"; inherits: true; initial-value: #5c5e66; }
@property --value        { syntax: "<color>"; inherits: true; initial-value: #a3a3a8; }
@property --frame        { syntax: "<color>"; inherits: true; initial-value: #05080fdb; }
@property --sheet        { syntax: "<color>"; inherits: true; initial-value: #12121ad1; }
@property --sheet-border { syntax: "<color>"; inherits: true; initial-value: #3c3c3c3c; }
@property --field        { syntax: "<color>"; inherits: true; initial-value: #21213278; }
@property --field-hover  { syntax: "<color>"; inherits: true; initial-value: #37374678; }
@property --item-text    { syntax: "<color>"; inherits: true; initial-value: #bdbdc2; }
@property --knob-off     { syntax: "<color>"; inherits: true; initial-value: #7d8791; }
@property --knob-on      { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --toggle-off   { syntax: "<color>"; inherits: true; initial-value: #05080f; }
@property --slider-track { syntax: "<color>"; inherits: true; initial-value: #3338454a; }
@property --icon-bright  { syntax: "<color>"; inherits: true; initial-value: #fffffff2; }
@property --hover        { syntax: "<color>"; inherits: true; initial-value: #4d4d57e6; }
@property --card-line    { syntax: "<color>"; inherits: true; initial-value: #24262e78; }
@property --shadow       { syntax: "<color>"; inherits: true; initial-value: #000000cc; }
@property --card         { syntax: "<color>"; inherits: true; initial-value: #15151db4; }
@property --panel        { syntax: "<color>"; inherits: true; initial-value: #0f0f1470; }
@property --action       { syntax: "<color>"; inherits: true; initial-value: #000000; }
@property --action-hover { syntax: "<color>"; inherits: true; initial-value: #181918; }
@property --wall-a       { syntax: "<color>"; inherits: true; initial-value: #09060f; }
@property --wall-b       { syntax: "<color>"; inherits: true; initial-value: #120c22; }
@property --accent       { syntax: "<color>"; inherits: true; initial-value: #a98bff; }

:root {
  /* dark palette @ 0x1806593A0 */
  --label: #d6d6db;  --muted: #73737dc8;  --text: #f2f2f2;  --caption: #5c5e66;  --value: #a3a3a8;
  --frame: #05080fdb;  --sheet: #12121ad1;  --sheet-border: #3c3c3c3c;
  --field: #21213278;  --field-hover: #37374678;  --item-text: #bdbdc2;
  --knob-off: #7d8791;  --knob-on: #ffffff;  --toggle-off: #05080f;  --slider-track: #3338454a;
  --icon-bright: #fffffff2;  --hover: #4d4d57e6;  --card-line: #24262e78;  --shadow: #000000cc;
  --card: #15151db4;  --panel: #0f0f1470;  --action: #000000;  --action-hover: #181918;
  --wall-a: #09060f;  --wall-b: #120c22;
  --accent: #a98bff;
  --error: #fc8d8d;

  /* hover fill = WithAlpha(T.hover, t * 0.4 * 0.9) ; t = 0.5 hovered, 1 active */
  --hover-fill-half: color-mix(in srgb, var(--hover) 18%, transparent);
  --hover-fill-full: color-mix(in srgb, var(--hover) 36%, transparent);
  --accent-hover: color-mix(in srgb, var(--accent) 80%, #fff);

  /* geometry (nl_widgets.h) */
  --fs-text: 13px;      /* kText 17.7 */
  --fs-value: 11.75px;  /* kValue 16   */
  --fs-small: 11px;     /* kSmall 15   */
  --fs-caption: 9.2px;  /* kCaption 12.5 */
  --row-h: 37.727px;
  --row-pad: 12.5px;
  --card-r: 10px;
  --popup-r: 12px;
  --ctrl-w: 135px;
  --field-h: 22px;
  --win-r: 14px;

  /* nl_anim easing */
  --out-cubic: cubic-bezier(0.33, 1, 0.68, 1);
  --in-out-cubic: cubic-bezier(0.65, 0, 0.35, 1);

  transition: --label .3s var(--out-cubic), --muted .3s var(--out-cubic), --text .3s var(--out-cubic),
    --caption .3s var(--out-cubic), --value .3s var(--out-cubic), --frame .3s var(--out-cubic),
    --sheet .3s var(--out-cubic), --sheet-border .3s var(--out-cubic), --field .3s var(--out-cubic),
    --field-hover .3s var(--out-cubic), --item-text .3s var(--out-cubic), --knob-off .3s var(--out-cubic),
    --knob-on .3s var(--out-cubic), --toggle-off .3s var(--out-cubic), --slider-track .3s var(--out-cubic),
    --icon-bright .3s var(--out-cubic), --hover .3s var(--out-cubic), --card-line .3s var(--out-cubic),
    --shadow .3s var(--out-cubic), --card .3s var(--out-cubic), --panel .3s var(--out-cubic),
    --action .3s var(--out-cubic), --action-hover .3s var(--out-cubic), --wall-a .3s var(--out-cubic),
    --wall-b .3s var(--out-cubic), --accent .2s var(--out-cubic);
  color-scheme: dark;
}

/* light palette @ 0x1806583C0 */
:root[data-theme="light"] {
  --label: #333333;  --muted: #262626;  --text: #000000;  --caption: #7a7a7ae6;  --value: #333333;
  --frame: #f5f5f5b3;  --sheet: #f2f2f2c8;  --sheet-border: #d9d9d9;
  --field: #d4d4d4;  --field-hover: #c7c7c7;  --item-text: #333333;
  --knob-off: #ffffff;  --knob-on: #ffffff;  --toggle-off: #d9d9d9;  --slider-track: #f2f2f2;
  --icon-bright: #262626;  --hover: #adadad;  --card-line: #827d7d3d;  --shadow: #0000004d;
  --card: #e3e3e3;  --panel: #f2f2f2aa;  --action: #e6e6e6;  --action-hover: #d9d9d9;
  --wall-a: #c9d3e6;  --wall-b: #e9edf5;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; } /* scroll.js does the smoothing */
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto NL", "Noto Sans", system-ui, sans-serif;
  font-weight: 500;
  color: var(--label);
  background: var(--wall-a);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ---------- surfaces ---------- */
.frosted { backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2); }
.sheet {
  background: var(--sheet);
  border: 1px solid var(--sheet-border);
  border-radius: var(--popup-r);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--shadow) 35%, transparent);
}
.ico { display: inline-block; flex: none; fill: currentColor; vertical-align: middle; }

/* NL badge (Badge(): #0a1520, radius s*0.2, faux-bold "NL") */
.badge {
  --s: 34px;
  width: var(--s); height: var(--s); flex: none;
  border-radius: calc(var(--s) * .2);
  background: #0a1520;
  color: #f1f5ff;
  display: grid; place-items: center;
  font-weight: 600; font-size: calc(var(--s) * .52 / 1.362);
  letter-spacing: -.02em;
  text-shadow: .5px 0 0 #f1f5ff, -.5px 0 0 #f1f5ff;
}

/* ---------- caption / card / rows ---------- */
.caption {
  font-size: var(--fs-caption); font-weight: 500; letter-spacing: .02em;
  text-transform: uppercase; color: var(--caption);
  padding-left: var(--row-pad); height: 17px; line-height: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--sheet-border);
  border-radius: var(--card-r);
}
.row {
  position: relative;
  height: var(--row-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 var(--row-pad);
  font-size: var(--fs-text);
  color: var(--label);
  user-select: none;
}
.row + .row::before { /* card_line separator, inset 7px */
  content: ""; position: absolute; left: 7px; right: 7px; top: -1px; height: 1px; background: var(--card-line);
}
.row + .row { margin-top: 1px; }
.row::after { /* RowHoverBg */
  content: ""; position: absolute; inset: 0 1px; border-radius: 9px; pointer-events: none;
  background: var(--hover-fill-full); opacity: 0;
  transition: opacity .2s var(--out-cubic);
}
.row.hov:hover::after, .row.hov.held::after { opacity: .5; }
.row.hov:active::after { opacity: 1; }
.row .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.row .val { font-size: var(--fs-value); color: var(--text); }
.row .val.dim { color: var(--label); }
.row > .ico { width: 11px; height: 11px; color: var(--label); flex: none; }
.row.flash::after { animation: flash 2s linear; }
@keyframes flash {
  0% { opacity: 1; background: color-mix(in srgb, var(--accent) 22%, transparent); }
  25% { opacity: .2; background: color-mix(in srgb, var(--accent) 22%, transparent); }
  50% { opacity: .6; background: color-mix(in srgb, var(--accent) 22%, transparent); }
  100% { opacity: 0; background: color-mix(in srgb, var(--accent) 22%, transparent); }
}
.btn {
  position: relative; height: 34px; padding: 0 16px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: var(--fs-text); font-weight: 500; white-space: nowrap;
  transition: background-color .2s var(--out-cubic), color .2s var(--out-cubic), border-color .2s var(--out-cubic), transform .2s var(--out-cubic);
}
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-action { background: var(--action); color: var(--text); border: 1px solid var(--sheet-border); }
.btn-action:hover { background: var(--action-hover); }
.btn-field { background: var(--field); border: 1px solid var(--sheet-border); color: var(--label); }
.btn-field:hover { background: var(--field-hover); }
.btn.lg { height: 42px; padding: 0 22px; border-radius: 10px; font-size: 14px; }
.btn .ico { width: 12px; height: 12px; }

/* ---------- page transitions ----------
   Cross-page (index <-> dashboard): the old page blurs and sinks, the new one zooms in (View Transitions, Chromium / Safari 18+).
   (No load-in animation on body: it delayed the first paint.) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .32s cubic-bezier(.4, 0, .2, 1) both; }
::view-transition-new(root) { animation: vt-in .55s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes vt-out { to { opacity: 0; transform: scale(.96); filter: blur(8px); } }
@keyframes vt-in { from { opacity: 0; transform: scale(1.04); filter: blur(10px); } }
