/* Orange Nexus V2 — "holographic glass" design tokens (owner-approved 2026-10-21).
   Every V2 rule lives under #nx2; the reset below starts its form, table and dialog
   elements from browser defaults, whatever page-level element rule exists. */

@font-face {
  font-family: "Alexandria";
  src: url("../fonts/alexandria/Alexandria-VF.woff2") format("woff2");
  font-weight: 200 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Michroma";
  src: url("../fonts/michroma/Michroma-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

#nx2 {
  /* Ground and light */
  --nx-base: #4a4e6e;
  --nx-ink: #2a2440;
  --nx-ink-2: #5a5470;
  --nx-white: #ffffff;
  --nx-text: #ffffff;
  --nx-text-2: rgba(255, 255, 255, 0.94);
  --nx-orange: #ff8a1f;
  --nx-orange-hi: #ffc24d;
  --nx-orange-lo: #ff7a00;
  --nx-orange-soft: #ffd089;
  --nx-violet: #6e5ae6;
  --nx-cyan: #28bedc;
  --nx-ok: #4ade80;

  /* Blobs (tuned for 4.5:1 text contrast; see tests/v2/contrast) */
  --nx-blob-orange: rgba(255, 150, 40, 0.78);
  --nx-blob-violet: rgba(110, 90, 230, 0.8);
  --nx-blob-cyan: rgba(40, 190, 220, 0.34);

  /* The specular corner sits at the top-end corner (top-left in Arabic,
     top-right in English), away from where headings start. */
  --nx-gloss-angle: 135deg;
  /* How far the specular corner reaches into a surface (shorter on phones,
     where lines of text run closer to the corner) */
  --nx-gloss-reach: 105px;
  --nx-sheen-angle: 118deg;
  /* Glossy glass (owner, 2026-10-23: "more gloss, never matte"): a bright
     specular corner white 55% → 14% → 6% → 28%, a crisp top edge with a soft
     inner glow, a 60% white border, a diagonal sheen on every glass surface and
     a saturated backdrop so the colours behind glow through. The ink layer
     underneath keeps white text at 4.5:1 where an orange blob shines through;
     the corner gloss fades over a fixed 105px and the far-corner glow rises over
     the last 140px, so wide or short panels keep highlights instead of a wash. */
  --nx-glass-fill: linear-gradient(
    var(--nx-gloss-angle),
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0.14) min(30%, var(--nx-gloss-reach)),
    rgba(255, 255, 255, 0.06) max(58%, calc(100% - 140px)),
    rgba(255, 255, 255, 0.28)
  );
  --nx-glass-ink: rgba(36, 30, 72, 0.46);
  --nx-glass-border: 1px solid rgba(255, 255, 255, 0.6);
  --nx-glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 14px 28px -20px rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.18);
  --nx-glass-drop: 0 24px 60px rgba(30, 20, 60, 0.26);
  /* A soft diagonal band of light across every glass surface (under the content) */
  --nx-sheen: linear-gradient(
    var(--nx-sheen-angle),
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.16) 44%,
    rgba(255, 255, 255, 0.04) 52%,
    rgba(255, 255, 255, 0) 64%
  );
  /* The sheen lives in the top part of a surface and fades out, so on a tall panel the band
     stays a highlight instead of crossing the headings in its top corners. */
  --nx-sheen-height: 340px;
  --nx-sheen-mask: linear-gradient(180deg, #000 55%, transparent);
  /* A folded text fades out towards its fold (the shop's product description). */
  --nx-fold-mask: linear-gradient(180deg, #000 62%, transparent);
  --nx-saturate: saturate(160%);
  --nx-backdrop: blur(var(--nx-blur)) var(--nx-saturate);

  /* ---- Glass materials: the only glass recipes in V2 ----
     Every component (present and future) takes its glass from these tokens;
     tests/v2 fails if a gradient or backdrop filter is written anywhere else. */

  /* Card: panels and sections (.nx-glass) — fill, ink, border, edge, drop above */
  --nx-glass-card: var(--nx-glass-fill), linear-gradient(var(--nx-glass-ink), var(--nx-glass-ink));

  /* List: the sticky master lists of master-detail screens. They stay at the top corner under
     the orange glow while the page scrolls, so the same gloss sits on a deeper ink. */
  --nx-glass-list: var(--nx-glass-fill), linear-gradient(rgba(36, 30, 72, 0.64), rgba(36, 30, 72, 0.64));

  /* Header band: the fixed header floats over scrolled content on its own frosted, tinted
     surface (deep ink, a soft blur), so nothing underneath stays readable behind the brand,
     the dock or the actions. */
  --nx-glass-header: linear-gradient(rgba(30, 24, 64, 0.84), rgba(30, 24, 64, 0.84));
  --nx-header-backdrop: blur(28px) saturate(140%);
  --nx-header-edge: 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 32px rgba(20, 14, 48, 0.28);

  /* Hero: the large sign-in form (.nx-glass--xl), the brightest gloss */
  --nx-glass-hero-fill: linear-gradient(
    var(--nx-gloss-angle),
    rgba(255, 255, 255, 0.6),
    rgba(255, 255, 255, 0.16) min(32%, 140px),
    rgba(255, 255, 255, 0.08) max(60%, calc(100% - 160px)),
    rgba(255, 255, 255, 0.32)
  );
  --nx-glass-hero-ink: rgba(36, 30, 72, 0.32);
  --nx-glass-hero: var(--nx-glass-hero-fill), linear-gradient(var(--nx-glass-hero-ink), var(--nx-glass-hero-ink));
  --nx-glass-hero-border: 1px solid rgba(255, 255, 255, 0.68);
  --nx-glass-hero-edge: inset 0 1px 0 rgba(255, 255, 255, 0.98), inset 0 16px 32px -22px rgba(255, 255, 255, 0.6),
    0 40px 100px rgba(30, 20, 60, 0.32);
  --nx-glass-hero-backdrop: blur(40px) var(--nx-saturate);

  /* Bar: the floating dock — gloss on the top edge over a deep ink, so labels
     hold 4.5:1 under the orange blob and over panels scrolling beneath */
  --nx-glass-bar: linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.12) 46%, rgba(255, 255, 255, 0.06)),
    linear-gradient(rgba(36, 30, 72, 0.8), rgba(36, 30, 72, 0.8));
  --nx-glass-bar-border: 1px solid rgba(255, 255, 255, 0.62);
  --nx-glass-bar-edge: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 10px 20px -14px rgba(255, 255, 255, 0.5),
    0 10px 40px rgba(20, 20, 50, 0.24);

  /* Control: glass buttons, header search, language and account — their own
     dark glass, so a label stays legible even in a panel's bright corner */
  --nx-glass-control: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.04) 55%), rgba(30, 24, 62, 0.6);
  --nx-glass-control-hover: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06) 55%), rgba(30, 24, 62, 0.72);
  --nx-glass-control-border: 1px solid rgba(255, 255, 255, 0.55);
  --nx-glass-control-edge: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --nx-glass-control-backdrop: blur(20px) var(--nx-saturate);

  /* Track: segmented controls and switch tracks — the unselected labels sit on it */
  --nx-glass-track: rgba(24, 20, 52, 0.4);
  --nx-glass-track-border: 1px solid rgba(255, 255, 255, 0.3);

  /* Tile: small glass cards such as the sign-in flow nodes (no sheen band) */
  --nx-glass-tile: linear-gradient(
      var(--nx-gloss-angle),
      rgba(255, 255, 255, 0.4),
      rgba(255, 255, 255, 0.1) 40%,
      rgba(255, 255, 255, 0.06) 62%,
      rgba(255, 255, 255, 0.24)
    ),
    linear-gradient(rgba(36, 30, 72, 0.52), rgba(36, 30, 72, 0.52));
  --nx-glass-tile-border: 1px solid rgba(255, 255, 255, 0.62);
  --nx-glass-tile-edge: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 8px 16px -10px rgba(255, 255, 255, 0.5),
    0 12px 30px rgba(30, 20, 60, 0.25);
  --nx-glass-tile-backdrop: blur(20px) var(--nx-saturate);

  /* Overlay: the command palette and future dialogs */
  --nx-glass-overlay: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1) 40%, rgba(255, 255, 255, 0.16)),
    rgba(48, 42, 88, 0.8);
  --nx-glass-overlay-border: 1px solid rgba(255, 255, 255, 0.55);
  --nx-glass-overlay-edge: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 40px 100px rgba(20, 10, 50, 0.45);
  --nx-glass-overlay-backdrop: blur(40px) var(--nx-saturate);
  --nx-scrim: rgba(40, 36, 70, 0.4);
  --nx-scrim-backdrop: blur(10px);

  /* Pearl: glossy white for the primary action and the selected item */
  --nx-pearl: #ffffff linear-gradient(180deg, #ffffff 0%, #ffffff 50%, #f1eef8 100%);
  --nx-pearl-edge: inset 0 1px 0 #ffffff, inset 0 -2px 6px rgba(42, 36, 64, 0.08);

  /* Light effects and brand fills (not glass, but kept here so no screen
     invents its own gradient) */
  --nx-sweep: linear-gradient(105deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  /* The shop's «كل المنتجات» tile (owner decision 2026-10-28): the brand's orange into violet. */
  --nx-brand-sweep: linear-gradient(135deg, #ff7a18, #ff3d6e 60%, #7b3fe4);
  --nx-shimmer: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.1));
  --nx-orange-fill: linear-gradient(135deg, #ffb347, #ff7a00);
  --nx-hub-fill: linear-gradient(145deg, rgba(255, 214, 150, 0.75), rgba(255, 138, 31, 0.55) 45%, rgba(200, 90, 0, 0.6));
  --nx-chevron: linear-gradient(45deg, transparent 50%, #ffffff 50%), linear-gradient(135deg, #ffffff 50%, transparent 50%);
  --nx-blur: 30px;

  /* Shape */
  --nx-r-xs: 12px;
  --nx-r-sm: 18px;
  --nx-r-md: 28px;
  --nx-r-lg: 32px;
  --nx-r-xl: 36px;
  --nx-pill: 999px;
  --nx-gap: 20px;

  /* Type: Alexandria for the interface, Michroma only for the ORANGE NEXUS wordmark */
  --nx-font: "Alexandria", "Segoe UI", Tahoma, system-ui, sans-serif;
  --nx-font-mark: "Michroma", "Alexandria", sans-serif;
  --nx-w-display: 200;
  --nx-w-light: 300;
  --nx-w-body: 400;
  --nx-w-title: 500;

  /* Focus: a white ring with a dark halo reads on every part of the backdrop */
  --nx-focus: 0 0 0 3px #ffffff, 0 0 0 6px rgba(42, 36, 64, 0.9);
  --nx-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

#nx2[dir="ltr"] {
  --nx-gloss-angle: 225deg;
  --nx-sheen-angle: 242deg;
}

/* ---- Elements from browser defaults ---- */
#nx2 :where(button, input, select, textarea, a, table, tbody, thead, tr, th, td, dialog, details, summary) {
  all: revert;
}
#nx2,
#nx2 *,
#nx2 *::before,
#nx2 *::after {
  box-sizing: border-box;
}

/* ---- Base ---- */
html[data-ui="v2"],
html[data-ui="v2"] body {
  margin: 0;
  background: #4a4e6e;
  color: #ffffff;
}
/* The console is a dark surface, and says so: what the browser draws by itself then takes its dark colours, light on
   dark as the page is. A native list's popup is one such thing wherever the browser does not let a page colour it
   (Firefox ESR 153 on Linux: dom.forms.select.customstyling is off): Firefox draws it from the system's colours, in
   the scheme of what it finds behind the select, which without this is the light one: a white list under a dark
   desktop theme (owner 2026-11-14).
   The fields a browser draws itself (a checkbox, a radio, a file's button) keep the light look they have on the glass:
   in the dark scheme an unticked box is dark on dark. */
html[data-ui="v2"] {
  color-scheme: dark;
}
#nx2 input {
  color-scheme: light;
}
/* The ORANGE NEXUS pointer (owner 2026-11-09, design 1: the buttons' orange, a dark edge for either background): every
   page's arrow (a file: the console's policy loads images from itself only). The hand stays on what is clickable, the
   text cursor in a field. */
#nx2 {
  cursor: url("/cursor.svg") 4 3, auto;
}
#nx2 a[href],
#nx2 button:not(:disabled),
#nx2 summary,
#nx2 label[for],
#nx2 select,
#nx2 [role="button"] {
  cursor: pointer;
}
#nx2 input:not(:disabled):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]),
#nx2 textarea:not(:disabled),
#nx2 [contenteditable="true"] {
  cursor: text;
}
#nx2 {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--nx-text);
  font-family: var(--nx-font);
  font-weight: var(--nx-w-light);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: lining-nums;
}
#nx2 :where(h1, h2, h3, h4, p, figure, ul, ol) {
  margin: 0;
}
#nx2 :where(ul, ol) {
  padding: 0;
  list-style: none;
}
#nx2 :where(button, input, select, textarea) {
  font: inherit;
  color: inherit;
}
#nx2 :where(a) {
  color: inherit;
}
#nx2 :where(img, svg) {
  display: block;
  max-width: 100%;
}
/* The focus ring wins over every component shadow, hover included. */
#nx2 :where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--nx-focus) !important;
}
#nx2 ::selection {
  background: rgba(255, 138, 31, 0.6);
  color: #ffffff;
}

/* Numbers stay Latin and left-to-right inside Arabic text */
#nx2 .nx-num {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums lining-nums;
}
/* A number reads left to right, but a block holding it (a cell, a value, a stat) keeps the page's
   alignment: in Arabic its start is the right edge and an end column the left (owner 2026-10-26). */
#nx2[dir="rtl"] .nx-num:not(.nx-bell__count) {
  text-align: right;
}
#nx2[dir="rtl"] .nx-cell--end.nx-num {
  text-align: left;
}
#nx2[dir="rtl"] :is(.nx-ident, .nx-sallasync__stats) dd.nx-num {
  justify-content: flex-end;
}
#nx2 .nx-display {
  font-weight: var(--nx-w-display);
  letter-spacing: -0.02em;
  line-height: 1;
}
#nx2 .nx-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Backdrop: base + three soft blobs ---- */
#nx2 .nx-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--nx-base);
  pointer-events: none;
}
#nx2 .nx-blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  animation: nx-drift 16s ease-in-out infinite;
}
#nx2 .nx-blob--orange {
  width: 900px;
  height: 900px;
  top: -380px;
  right: -260px; /* physical, as designed: orange top-right in both languages */
  background: radial-gradient(circle, var(--nx-blob-orange), rgba(255, 120, 20, 0) 65%);
}
#nx2 .nx-blob--violet {
  width: 860px;
  height: 860px;
  bottom: -400px;
  left: -220px;
  background: radial-gradient(circle, var(--nx-blob-violet), rgba(110, 90, 230, 0) 65%);
  animation-delay: -6s;
}
#nx2 .nx-blob--cyan {
  width: 620px;
  height: 620px;
  top: 32%;
  left: 34%;
  background: radial-gradient(circle, var(--nx-blob-cyan), rgba(40, 190, 220, 0) 65%);
  animation: none;
}
/* Phones: the blobs keep their corners but shrink with the screen, so the orange
   light stays a corner glow instead of washing behind the whole form. */
@media (max-width: 720px) {
  #nx2 {
    --nx-blob-orange: rgba(255, 150, 40, 0.7);
    --nx-gloss-reach: 80px;
  }
  #nx2 .nx-blob--orange {
    width: 560px;
    height: 560px;
    top: -330px;
    right: -250px;
  }
  #nx2 .nx-blob--violet {
    width: 560px;
    height: 560px;
    bottom: -300px;
    left: -220px;
  }
  #nx2 .nx-blob--cyan {
    width: 420px;
    height: 420px;
    left: 10%;
  }
}
@keyframes nx-drift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(30px, -20px);
  }
}

/* ---- Motion and platform fallbacks ---- */
@media (prefers-reduced-motion: reduce) {
  #nx2 *,
  #nx2 *::before,
  #nx2 *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  #nx2 .nx-blob,
  #nx2 .nx-shine::after {
    animation: none !important;
  }
  #nx2 .nx-shine::after {
    display: none;
  }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  #nx2 {
    --nx-glass-ink: rgba(36, 30, 72, 0.55);
  }
}
@media (prefers-contrast: more) {
  #nx2 {
    --nx-glass-ink: rgba(30, 24, 60, 0.6);
    --nx-glass-border: 1px solid #ffffff;
  }
}
@media (forced-colors: active) {
  #nx2 .nx-backdrop {
    display: none;
  }
  #nx2 .nx-glass,
  #nx2 .nx-btn,
  #nx2 .nx-input,
  #nx2 .nx-select,
  #nx2 .nx-chip,
  #nx2 .nx-dock {
    border: 1px solid CanvasText;
  }
}
