/* ─────────────────────────────────────────────────────────────────────
   Plexus — shared foundation (home, tech, protocol).
   Warm premium business: ivory canvas, deep navy ink, one terracotta accent,
   calm forest secondary. Dark theme = warm dark, same tokens.
   ───────────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --ground:  #F2F3F5;
  --surface: #FFFFFF;
  --sunk:    #E6E8EC;
  --ink:     #14181F;
  --muted:   #444C57;
  --faint:   #525B67;
  --wire:    #DDE0E5;
  --wire-2:  #C3C8CF;
  --accent:  #2C5C9A;
  --accent-2:#224A7E;
  --glow:    #7FA6D6;
  --glow-2:  #BBD0EA;
  --btn:     #2F62A3;
  --btn-2:   #24508A;
  --btn-ink: #FFFFFF;
  --forest:  #2E3A48;
  --forest-soft:#E3E8EE;
  --signal:  #4A5360;
  --signal-bg:#E6E8EC;
  --ok:      #2E3A48;
  --code-bg: #1E232B;
  --code-ink:#E6E8EC;
  --hdr-bg:  rgba(242,243,245,.86);
  --hdr-solid:#F2F3F5;
  --shadow:  0 1px 2px rgba(20,30,50,.05), 0 12px 32px -14px rgba(20,30,50,.2);
  --shadow-lg: 0 2px 4px rgba(20,30,50,.05), 0 34px 70px -28px rgba(20,30,60,.32);
  --grid:    transparent;
  --r:       20px;
  --r-sm:    14px;
  --gutter:  clamp(20px, 4vw, 40px);
  --wrapw:   1200px;
  --sec:     clamp(56px, 6.5vw, 96px);
  --display: "Figtree", "Readex Pro", ui-sans-serif, system-ui, sans-serif;
  --body:    "Figtree", "Readex Pro", ui-sans-serif, system-ui, sans-serif;
  --mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;   /* only <pre>/<code> on the technical pages */
  --measure: 66ch;
  --hh: 68px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground:  #12151A;
  --surface: #1C2027;
  --sunk:    #0E1115;
  --ink:     #EEF0F3;
  --muted:   #B9C0CA;
  --faint:   #9AA3AF;
  --wire:    #2A303A;
  --wire-2:  #3C4452;
  --accent:  #9DBDE6;
  --accent-2:#BBD0EA;
  --glow:    #6F98CC;
  --glow-2:  #A9C4E6;
  --btn:     #8DB1E0;
  --btn-2:   #A9C4E6;
  --btn-ink: #10151C;
  --forest:  #AEBBCB;
  --forest-soft:#232A34;
  --signal:  #C9D0DA;
  --signal-bg:#252B35;
  --ok:      #AEBBCB;
  --code-bg: #0B0E12;
  --code-ink:#DDE2E9;
  --hdr-bg:  rgba(18,21,26,.84);
  --hdr-solid:#12151A;
  --shadow:  0 1px 2px rgba(0,0,0,.4), 0 14px 34px -14px rgba(0,0,0,.6);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 34px 70px -28px rgba(0,0,0,.7);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hh) + 12px); }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video, canvas { max-width: 100%; }
img { display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--glow-2); color: #1B1510; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; letter-spacing: -.015em; text-wrap: balance; }
p { text-wrap: pretty; }
[hidden] { display: none !important; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrapw)); margin-inline: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; right: 12px; top: -80px; z-index: 100; background: var(--ink); color: var(--ground);
  padding: 12px 16px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 10px; color: var(--ground); text-decoration: none; }

/* small labels: plain humanist type, no instrument look */
.btn, th { font-family: var(--body); }
code, pre { font-family: var(--mono); }
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem; margin: 0 0 1rem;
  font: 600 .9rem/1.2 var(--body); letter-spacing: .01em; color: var(--accent);
}
.eyebrow::before { content: ""; width: 22px; height: 2px; flex: none; background: var(--glow); border-radius: 2px; }

/* ── header ───────────────────────────────────────────────────────── */
header.site {
  position: sticky; top: 0; z-index: 50;
  background: var(--hdr-solid);                       /* opaque fallback */
  background: var(--hdr-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--wire);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { header.site { background: var(--hdr-solid); } }
header.site nav { display: flex; align-items: center; gap: 1.1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); min-height: 44px; }
.brand:hover { text-decoration: none; }
.brand svg.mark { width: 22px; height: 22px; color: var(--accent); flex: none; }
.brand svg.word { height: 17px; width: auto; color: var(--ink); }
.brand .nm { font: 700 1.2rem var(--display); letter-spacing: -.01em; }
header.site .spacer { flex: 1; }
.links { display: flex; align-items: center; gap: .15rem; }
.navlink {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 .7rem;
  color: var(--muted); font: 500 .86rem var(--body); border-radius: 8px;
}
.navlink:hover { color: var(--ink); text-decoration: none; }
.navlink, .btn.nav-cta { white-space: nowrap; }
@media (min-width: 961px) and (max-width: 1200px) { .navlink { padding: 0 .4rem; font-size: .8rem; } .links { gap: 0; } header.site .btn.nav-cta { padding-inline: .8rem; } }
.navlink::after { content: ""; position: absolute; right: .7rem; left: .7rem; bottom: 7px; height: 2px; border-radius: 2px;
  background: var(--btn); transform: scaleX(0); transform-origin: right; transition: transform .3s cubic-bezier(.2,.7,.2,1); }
.navlink[aria-current]::after { transform: scaleX(1); }   /* only the current section is underlined; hover changes colour only */
.navlink[aria-current] { color: var(--ink); }
.theme {
  appearance: none; -webkit-appearance: none; flex: none; cursor: pointer; padding: 0;
  width: 44px; height: 44px; display: grid; place-items: center;
  background: transparent; color: var(--muted); border: 1px solid var(--wire); border-radius: 12px;
  transition: color .2s, border-color .2s, background .2s;
}
.theme.lang { display: inline-grid; place-items: center; font-size: 15px; font-weight: 600; text-decoration: none; }
.theme:hover { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.theme svg { width: 17px; height: 17px; display: block; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.theme:hover svg { transform: rotate(-180deg); }
.menu-btn { display: none; appearance: none; -webkit-appearance: none; cursor: pointer; width: 44px; height: 44px; padding: 0;
  place-items: center; background: transparent; color: var(--ink); border: 1px solid var(--wire); border-radius: 12px; }
.menu-btn svg { width: 22px; height: 22px; }
.menu-btn path { transform-origin: center; transition: transform .3s, opacity .2s; }
.menu-btn[aria-expanded="true"] .l1 { transform: translateY(5px) rotate(-45deg); }
.menu-btn[aria-expanded="true"] .l2 { opacity: 0; }
.menu-btn[aria-expanded="true"] .l3 { transform: translateY(-5px) rotate(45deg); }
.progress { position: absolute; right: 0; left: 0; bottom: -1px; height: 2px; pointer-events: none; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(-90deg, var(--glow-2), var(--btn)); transform: scaleX(0); transform-origin: right; will-change: transform; }

@media (max-width: 960px) {
  .menu-btn { display: grid; }
  .nav-cta { display: none; }
  .links {
    position: absolute; right: 0; left: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--hdr-solid); border-bottom: 1px solid var(--wire); padding: .5rem var(--gutter) 1rem;
    box-shadow: 0 24px 40px -24px rgba(90,60,30,.28);
    visibility: hidden; opacity: 0; transform: translateY(-8px); pointer-events: none;
    transition: opacity .25s, transform .25s, visibility 0s .25s;
    max-height: calc(100dvh - 64px); overflow-y: auto;
  }
  .links.open { visibility: visible; opacity: 1; transform: none; pointer-events: auto; transition: opacity .25s, transform .25s; }
  .navlink { padding: 0 .4rem; font-size: 1.05rem; border-bottom: 1px solid var(--wire); border-radius: 0; min-height: 52px; }
  .navlink::after { display: none; }
  .navlink[aria-current] { color: var(--accent); }
  .links .btn { margin-top: .9rem; }
}
@media (min-width: 961px) { .links .menu-cta { display: none; } }

/* ── buttons ──────────────────────────────────────────────────────── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 48px; padding: .7rem 1.4rem; font-size: .98rem; font-weight: 600; letter-spacing: 0; line-height: 1.2;
  border: 1px solid var(--wire-2); border-radius: 99px; color: var(--ink); background: var(--surface);
  cursor: pointer; text-align: center;
  transition: border-color .2s, background .2s, color .2s, box-shadow .25s, transform .2s;
}
.btn:hover { border-color: var(--btn); color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--btn-ink);
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--btn) 75%, transparent); }
.btn.primary:hover { background: var(--btn-2); border-color: var(--btn-2); color: var(--btn-ink);
  box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--btn) 80%, transparent); }
.btn.ghost { background: transparent; }
.btn .arrow { transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.btn:hover .arrow { transform: translateX(-4px); }
.btn:active { transform: translateY(1px); }
.mag { will-change: transform; }

/* ── reveal: visible by default; hidden only when JS + IO are present ── */
.js .rv { opacity: 0; transform: translateY(20px); transition: opacity .8s cubic-bezier(.2,.7,.2,1) var(--d, 0s), transform .8s cubic-bezier(.2,.7,.2,1) var(--d, 0s); }
.js .rv.in { opacity: 1; transform: none; }

/* ── soft wave divider (replaces the old line-with-nodes) ─────────── */
.trace { display: block; width: 100%; height: 24px; color: var(--wire-2); overflow: visible; }
.trace path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.js .trace path { stroke-dashoffset: 1; transition: stroke-dashoffset 1.8s cubic-bezier(.4,0,.2,1); }
.js .trace.in path { stroke-dashoffset: 0; }
.trace circle { display: none; }
.status { display: inline-flex; align-items: center; gap: .4rem; font: 600 .84rem/1 var(--body); color: var(--forest); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── footer (shared by every page) ────────────────────────────────── */
footer { position: relative; border-top: 1px solid var(--wire); padding: 56px 0 64px; color: var(--muted); font-size: .92rem; background: var(--sunk); }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }
footer .row { display: flex; flex-wrap: wrap; gap: 2.2rem 3.5rem; align-items: flex-start; }
footer h3, footer h4 { font: 600 .95rem/1.2 var(--display); color: var(--ink); margin: 0 0 .9rem; }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
footer ul a { display: inline-flex; align-items: center; min-height: 36px; }
footer .brand .mark { color: var(--accent); }
footer .brand span.mono, footer .brand .nm { color: var(--ink); }
footer .fine { margin-top: 2.2rem; display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; align-items: center; font: 400 .88rem var(--body); color: var(--faint); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .js .rv { opacity: 1; transform: none; }
  .js .trace path { stroke-dashoffset: 0; }
  .js .trace circle { opacity: 1; }
}

/* visually hidden but readable by search engines and screen readers */
.srh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }


/* ── Arabic typography (appended after rtlcss): joined letters must not be tracked or upper-cased ── */
html[dir="rtl"] body, html[dir="rtl"] button, html[dir="rtl"] input { font-family: "Readex Pro", "Figtree", ui-sans-serif, system-ui, sans-serif; }
html[dir="rtl"] *, html[dir="rtl"] *::before, html[dir="rtl"] *::after { letter-spacing: 0 !important; text-transform: none !important; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] h4 { line-height: 1.3; }
html[dir="rtl"] .hero h1 { line-height: 1.25; font-size: clamp(32px, 4.4vw, 72px); }
html[dir="rtl"] .hero h1 .w { padding-bottom: .22em; }
html[dir="rtl"] .big { line-height: 1.25; }
html[dir="rtl"] p, html[dir="rtl"] li { line-height: 1.75; }
html[dir="rtl"] .arrow { display: inline-block; transform: scaleX(-1); }
html[dir="rtl"] #nstep { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .lang { font-size: 12px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
