/* Xtended Techs: shared design system (glass in cool grey, white and cobalt).
   Loaded by every page: /index.html and /super-rtl/*.html.
   CSP: external file only (style-src 'self'); no data: URIs (img-src 'self').
   Theme: <html data-theme="light|dark"> is set by the inline theme-init script. */

@property --lr { syntax: '<length>'; inherits: true; initial-value: 92px; }

:root {
  color-scheme: light;
  --ground: #EEF0F3;
  --surface: #FFFFFF;
  --screen: #FFFFFF;
  --ink: #111317;
  --muted: #4D535C;
  --faint: #656B74;
  --accent: #2350D8;
  --accent-hover: #2B5CE8;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(35, 80, 216, .09);
  --accent-line: rgba(35, 80, 216, .24);
  --glass: rgba(255, 255, 255, .50);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-solid: #FFFFFF;
  --edge: rgba(17, 19, 23, .10);
  --edge-strong: rgba(17, 19, 23, .22);
  --edge-hi: rgba(255, 255, 255, .95);
  --hover: rgba(17, 19, 23, .05);
  --broken: #3A4049;
  --math: #1A3DAA;
  --code-bg: #111317;
  --code-ink: #E4E8EF;
  --shadow: rgba(28, 40, 80, .22);
  --lens-ring: rgba(35, 80, 216, .45);
  --lens-glow: rgba(35, 80, 216, .10);
  --field-1: rgba(35, 80, 216, .20);
  --field-2: rgba(110, 150, 255, .26);
  --field-3: rgba(255, 255, 255, .95);
  --warn-bg: #FDF1D8;
  --warn-ink: #5A3D00;

  --sans: "Assistant", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-panel: 26px;
  --r-inner: 16px;
  --r-sm: 12px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --wrap: 1240px;
  --narrow: 820px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0A0D14;
  --surface: #121726;
  --screen: #111521;
  --ink: #E9ECF3;
  --muted: #A6AEBF;
  --faint: #858DA1;
  --accent: #7393F7;
  --accent-hover: #8DA7FA;
  --accent-ink: #0A1230;
  --accent-soft: rgba(115, 147, 247, .13);
  --accent-line: rgba(115, 147, 247, .30);
  --glass: rgba(200, 212, 255, .05);
  --glass-strong: rgba(200, 212, 255, .10);
  --glass-solid: #151A28;
  --edge: rgba(220, 228, 255, .14);
  --edge-strong: rgba(220, 228, 255, .28);
  --edge-hi: rgba(255, 255, 255, .22);
  --hover: rgba(255, 255, 255, .06);
  --broken: #C3C9D6;
  --math: #A9BCFF;
  --code-bg: rgba(0, 0, 0, .35);
  --code-ink: #D9DFEC;
  --shadow: rgba(0, 0, 0, .65);
  --lens-ring: rgba(255, 255, 255, .50);
  --lens-glow: rgba(115, 147, 247, .16);
  --field-1: rgba(35, 80, 216, .38);
  --field-2: rgba(60, 110, 240, .22);
  --field-3: rgba(120, 160, 255, .10);
  --warn-bg: #2E2410;
  --warn-ink: #F3D9A0;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { background: var(--ground); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6;
  color: var(--ink); background: transparent;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
/* The light behind the glass: fixed colour fields the panels refract while scrolling */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42vw 38vw at 18% 22%, var(--field-1), transparent 70%),
    radial-gradient(36vw 30vw at 92% 78%, var(--field-2), transparent 70%),
    radial-gradient(30vw 26vw at 70% 8%, var(--field-3), transparent 70%);
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
code, pre, kbd { font-family: var(--mono); font-size: .92em; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
html { scrollbar-color: var(--edge-strong) transparent; }

h1, h2, h3 { font-weight: 800; letter-spacing: -.02em; line-height: 1.12; text-wrap: balance; }
h2 { font-size: clamp(2rem, 3.4vw, 3rem); }
p { text-wrap: pretty; }

.container { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; }
.container-narrow { width: min(var(--narrow), 100% - 2.5rem); }

.skip-link {
  position: absolute; inset-inline-start: 1rem; top: -100px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: .7rem 1.1rem;
  border-radius: 999px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.icon { width: 1.25em; height: 1.25em; flex: none; }
[dir="ltr"] .icon-flip { transform: scaleX(-1); }

/* ── Glass ── */
.glass {
  background: linear-gradient(160deg, var(--glass-strong), var(--glass) 60%);
  border: 1px solid var(--edge);
  border-radius: var(--r-panel);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
          backdrop-filter: blur(22px) saturate(160%);
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 30px 80px -40px var(--shadow);
}

/* ── Header (glass pill) ── */
.site-header { position: sticky; top: 14px; z-index: 50; margin-top: 14px; }
.header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  padding: .5rem .55rem; padding-inline-start: 1.1rem; border-radius: 999px;
  background: linear-gradient(160deg, var(--glass-strong), var(--glass) 60%);
  border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
          backdrop-filter: blur(22px) saturate(160%);
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 20px 50px -34px var(--shadow);
}
.logo { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; white-space: nowrap; }
.logo-mark { color: var(--accent); font-weight: 800; }
.logo-sub { font-weight: 400; color: var(--muted); }
.primary-nav { display: flex; gap: .2rem; }
.primary-nav a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: .98rem;
  padding: .45rem .85rem; border-radius: 999px; white-space: nowrap;
  transition: color .2s, background-color .2s;
}
.primary-nav a:hover { color: var(--ink); background: var(--hover); }
.header-tools { display: flex; align-items: center; gap: .35rem; }
.lang-switcher { display: flex; gap: .25rem; }
.lang-switcher button {
  border: 1px solid var(--edge); background: transparent; color: var(--muted);
  font: 600 .9rem/1 var(--sans); padding: .55rem .75rem; min-height: 40px; border-radius: 999px; cursor: pointer;
  transition: color .2s, background-color .2s, border-color .2s;
}
.lang-switcher button:hover { color: var(--ink); }
.lang-switcher button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.lang-divider { display: none; }
.theme-toggle {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
  border-radius: 50%; border: 1px solid var(--edge); background: transparent; color: var(--ink); cursor: pointer;
  transition: background-color .2s, transform .3s var(--ease);
}
.theme-toggle:hover { background: var(--hover); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Phones: nav drops to its own scrollable row inside the pill, no hidden links */
@media (max-width: 900px) {
  .site-header { top: 8px; margin-top: 8px; }
  .header-inner { flex-wrap: wrap; border-radius: 24px; padding: .5rem .55rem .45rem; padding-inline-start: 1rem; }
  .primary-nav {
    order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none;
    margin-inline: -.3rem; padding-top: .35rem; border-top: 1px solid var(--edge);
  }
  .primary-nav::-webkit-scrollbar { display: none; }
  .primary-nav a { padding: .4rem .7rem; font-size: .95rem; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  text-decoration: none; font-weight: 700; font-size: 1.05rem; line-height: 1.2;
  padding: .85rem 1.35rem; min-height: 48px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  transition: transform .25s var(--ease), background-color .25s, box-shadow .25s, color .25s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn-large { font-size: 1.1rem; padding: .95rem 1.5rem; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 12px 30px -12px var(--accent-line); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary, .btn-glass { color: var(--ink); border-color: var(--edge); background: var(--glass); }
.btn-secondary:hover, .btn-glass:hover { background: var(--glass-strong); }
.btn .icon, .btn-icon { width: 1.15em; height: 1.15em; flex: none; transition: transform .3s var(--ease); }
.btn-primary:hover .icon-go { transform: translateX(-4px); }
[dir="ltr"] .btn-primary:hover .icon-go { transform: scaleX(-1) translateX(-4px); }
[dir="rtl"] .btn-icon-arrow { transform: scaleX(-1); }
.btn[aria-disabled="true"] { cursor: default; opacity: .7; box-shadow: none; }
.btn[aria-disabled="true"]:active { transform: none; }
.btn[aria-disabled="true"].btn-primary:hover { background: var(--accent); }

/* ── Footer ── */
.site-footer { margin-top: clamp(3rem, 7vw, 5rem); padding-block: 2.4rem 2.8rem; color: var(--faint); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1.4rem 2.5rem; padding-top: 2rem; border-top: 1px solid var(--edge); }
.footer-brand { display: grid; gap: .5rem; max-width: 40ch; }
.footer-brand p { color: var(--muted); font-size: .98rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; }
.footer-nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; margin-top: 1.6rem; font-size: .95rem; }
.copyright { color: var(--faint); text-decoration: none; }
.copyright:hover { color: var(--ink); }

/* ── Accessibility widget (injected by /a11y-widget.js; classes only) ──
   Physically bottom-left in RTL and LTR per spec. */
.a11y-fab {
  position: fixed; bottom: 22px; left: 22px; z-index: 90;
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent-line); cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 14px 30px -12px var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.a11y-fab:hover { transform: translateY(-2px); }
.a11y-fab-icon { width: 28px; height: 28px; }
.a11y-panel {
  position: fixed; bottom: 86px; left: 22px; z-index: 91;
  width: 300px; max-width: calc(100vw - 44px); padding: 1.2rem 1.3rem;
  background: var(--glass-solid); color: var(--ink);
  border: 1px solid var(--edge-strong); border-radius: 20px; box-shadow: 0 30px 70px -30px var(--shadow);
}
.a11y-panel[hidden] { display: none; }
.a11y-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .4rem; }
.a11y-panel-title { font-size: 1.2rem; font-weight: 800; }
.a11y-panel-close { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--edge-strong); background: transparent; color: var(--muted); cursor: pointer; }
.a11y-panel-close:hover { color: var(--ink); border-color: var(--accent); }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .95rem 0; border-top: 1px solid var(--edge); }
.a11y-row-label { font-size: 1.05rem; }
.a11y-fontctrls { display: inline-flex; align-items: center; gap: .4rem; flex: none; }
.a11y-stepbtn { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--edge-strong); background: var(--ground); color: var(--ink); font-weight: 700; cursor: pointer; }
.a11y-stepbtn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.a11y-stepbtn:disabled { opacity: .4; cursor: not-allowed; }
.a11y-fontlevel { min-width: 4ch; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.a11y-toggle { position: relative; width: 52px; height: 30px; flex: none; cursor: pointer; border-radius: 999px; border: 1px solid var(--edge-strong); background: var(--hover); transition: background-color .2s, border-color .2s; }
.a11y-toggle-knob { position: absolute; top: 50%; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--faint); transform: translateY(-50%); transition: inset-inline-start .25s var(--ease), background-color .2s; }
.a11y-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.a11y-toggle[aria-pressed="true"] .a11y-toggle-knob { inset-inline-start: calc(100% - 25px); background: var(--accent-ink); }
.a11y-reset { margin-top: 1rem; width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--edge-strong); background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.a11y-reset:hover { color: var(--ink); border-color: var(--accent); }
@media (max-width: 480px) {
  .a11y-fab { bottom: 14px; left: 14px; }
  .a11y-panel { bottom: 76px; left: 14px; }
}
html.a11y-fs-1 { font-size: 120%; }
html.a11y-fs-2 { font-size: 140%; }
html.a11y-contrast {
  --muted: #23262F; --faint: #353A47; --edge: rgba(17, 19, 23, .45); --edge-strong: rgba(17, 19, 23, .7);
  --glass: rgba(255, 255, 255, .92); --glass-strong: #FFFFFF;
}
html.a11y-contrast[data-theme="dark"] {
  --muted: #DDE1EB; --faint: #C4C9D6; --edge: rgba(255, 255, 255, .45); --edge-strong: rgba(255, 255, 255, .7);
  --glass: rgba(10, 13, 20, .92); --glass-strong: #0A0D14;
}
html.a11y-contrast :focus-visible { outline-width: 3px; }
html.a11y-reduce-motion *, html.a11y-reduce-motion *::before, html.a11y-reduce-motion *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important; scroll-behavior: auto !important;
}

/* ── Platform preferences ── */
@media (prefers-reduced-transparency: reduce) {
  .glass, .header-inner { background: var(--glass-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --muted: #23262F; --faint: #353A47; --edge: rgba(17, 19, 23, .45); }
  :root[data-theme="dark"] { --muted: #DDE1EB; --faint: #C4C9D6; --edge: rgba(255, 255, 255, .45); }
  :focus-visible { outline-width: 3px; }
}
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid Highlight; outline-offset: 2px; }
  .btn-primary { border: 1px solid ButtonText; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
