/* ==========================================
   IT-Impulse — Impulse Campus design system
   Evening campus · architectural glass · one calm accent
   Outfit · Manrope · JetBrains Mono (tabular nums)
   ========================================== */

/* ------------------------------------------------------------------
   Responsive contract (P0 Foundations)

   CSS custom properties CANNOT be used inside @media queries.
   Canon = this table + matching numbers in static/js/viewport.js.
   Do not invent new magic widths (767, 640, 700, …).

   | Token name | px   | Meaning                                       |
   |------------|------|-----------------------------------------------|
   | bp-sm      | 560  | compact chrome / single-col densify           |
   | bp-md      | 720  | phone primary (reception already uses this)   |
   | bp-lg      | 900  | tablet + mobile nav (shell already uses this) |
   | bp-xl      | 1080 | dual-column → single (contact)                |
   | bp-calc    | 980  | calculator sticky summary                     |

   Max-width pairs (canonical): 560 / 720 / 900 / 980 / 1080
   Min-width mirrors (allowed): 561 / 721 / 901 / 981 / 1081

   Page agents:
   - Prefer tokens below (--container-max, --nx-gutter, --nx-header-offset,
     --nx-fs-*, --nx-tap-min, --space-* / --nx-space-*) over raw px.
   - For matchMedia / JS layout: import { BP, mqMax } from './viewport.js'
     instead of hardcoding breakpoint numbers.
   - Interactive controls (menu, CTA, chips) ≥ --nx-tap-min on touch / ≤bp-lg
     unless an exception is explicitly documented.
   ------------------------------------------------------------------ */

:root {
  color-scheme: dark;

  /* Evening campus — void, glass, champagne */
  --nx-bg-void: #0e1116;
  --nx-bg-deep: #151922;
  --nx-bg-surface: rgba(22, 28, 38, 0.72);
  --nx-bg-elevated: rgba(28, 34, 46, 0.88);
  --nx-bg-glass: rgba(18, 24, 34, 0.55);
  --nx-bg-glass-strong: rgba(14, 18, 26, 0.82);

  --nx-accent: #e8ecf0;
  --nx-accent-soft: #f4f6f8;
  --nx-accent-dim: #c8d0d8;
  --nx-accent-glow: rgba(232, 236, 240, 0.12);
  --nx-accent-glow-strong: rgba(232, 236, 240, 0.2);

  --nx-on-accent: #12161c;

  --nx-tint: color-mix(in oklab, var(--nx-accent) 8%, transparent);
  --nx-tint-strong: color-mix(in oklab, var(--nx-accent) 16%, transparent);

  --nx-border: rgba(255, 255, 255, 0.1);
  --nx-border-strong: rgba(255, 255, 255, 0.18);
  --nx-border-glass: rgba(255, 255, 255, 0.14);
  --nx-grid: rgba(255, 255, 255, 0.05);

  /* Manrope after display faces: Outfit/Space Grotesk ship latin-only, so
     Cyrillic must not fall through to system-ui with mismatched metrics. */
  --nx-font-display: 'Outfit', 'Manrope', system-ui, sans-serif;
  --nx-font-body: 'Manrope', system-ui, sans-serif;
  --nx-font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Header chrome */
  --nx-font-signal: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
  --nx-font-signal-mono: 'JetBrains Mono', ui-monospace, monospace;
  --nx-font-frame: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
  --nx-font-editorial: 'Outfit', 'Manrope', system-ui, sans-serif;

  /* Type rhythm — tuned for Cyrillic body copy on glass panels */
  --nx-leading-display: 1.22;
  --nx-leading-tight: 1.4;
  --nx-leading-normal: 1.58;
  --nx-leading-relaxed: 1.68;
  --nx-leading-prose: 1.72;
  --nx-tracking-body: 0.014em;
  --nx-tracking-display: -0.02em;

  --nx-radius-sm: 4px;
  --nx-radius-md: 10px;
  --nx-radius-lg: 16px;
  --nx-radius-xl: 22px;
  --nx-radius-orb: 999px;
  --nx-radius-sharp: 0;
  --nx-radius-edge: 2px;

  --nx-ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --nx-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --nx-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --bg-primary: var(--nx-bg-void);
  --bg-card: var(--nx-bg-surface);
  --bg-card-2: var(--nx-bg-deep);
  --bg-elevated: var(--nx-bg-elevated);
  --border: var(--nx-border);
  --border-strong: var(--nx-border-strong);
  --accent: var(--nx-accent);
  --accent-hover: var(--nx-accent-soft);
  --accent-dim: var(--nx-accent-dim);
  --accent-glow: var(--nx-accent-glow);
  --accent-glow-strong: var(--nx-accent-glow-strong);
  --text-primary: #f2f4f7;
  --text-secondary: #b8bfc9;
  --text-muted: #8b94a1;

  /* Layout — container canon is 1200 (aligned with style.css) */
  --container-max: 1200px;
  --nx-gutter: clamp(20px, 4vw, 48px);

  /* Fixed canopy clearance + safe-area. Prefer these over raw 72/88/104/110px.
     Page agents may migrate padding-top to these; values are not wired site-wide in P0. */
  --nx-header-offset-sm: calc(72px + env(safe-area-inset-top, 0px));
  --nx-header-offset-md: calc(88px + env(safe-area-inset-top, 0px));
  --nx-header-offset-lg: calc(104px + env(safe-area-inset-top, 0px));
  --nx-header-offset: calc(clamp(72px, 10vw, 110px) + env(safe-area-inset-top, 0px));

  /* Fluid type scale — declare only; do not rewrite page font-size in P0 */
  --nx-fs-micro: clamp(0.6875rem, 0.65rem + 0.2vw, 0.75rem);
  --nx-fs-caption: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --nx-fs-body: clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem);
  --nx-fs-lead: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --nx-fs-title: clamp(1.375rem, 1.2rem + 0.9vw, 2rem);
  --nx-fs-display: clamp(1.75rem, 1.35rem + 1.8vw, 3rem);

  /* Min touch target on ≤bp-lg / coarse pointer (exceptions must be documented) */
  --nx-tap-min: 44px;

  /* Spacing aliases → legacy --space-* from style.css; prefer these over raw 8/12/16 */
  --nx-space-1: var(--space-1);
  --nx-space-2: var(--space-2);
  --nx-space-3: var(--space-3);
  --nx-space-4: var(--space-4);
  --nx-space-5: var(--space-5);
  --nx-space-6: var(--space-6);
  --nx-space-8: var(--space-8);

  --font-display: var(--nx-font-display);
  --font-mono: var(--nx-font-mono);

  /* Campus glass */
  --campus-glass: rgba(16, 22, 32, 0.45);
  --campus-glass-strong: rgba(16, 22, 32, 0.72);
  /* Exact fill of .nx-canopy__rail — one source for surfaces site-wide */
  --campus-header-bg: linear-gradient(
    180deg,
    color-mix(in srgb, var(--campus-glass-strong) 74%, transparent) 0%,
    color-mix(in srgb, var(--campus-glass) 66%, transparent) 100%
  );
  --campus-header-blur: blur(16px) saturate(1.1);
  --campus-ink: #f2f4f7;
  --campus-ink-dim: rgba(242, 244, 247, 0.82);
  --campus-line: rgba(255, 255, 255, 0.35);
  --campus-line-dim: rgba(255, 255, 255, 0.18);
  --campus-mark: #a4adb8;
  --campus-impulse: #d4c4a8;
  --campus-impulse-bright: #e8d9b8;
}

body {
  font-family: var(--nx-font-body);
  background: var(--nx-bg-void);
  color: var(--text-primary);
  line-height: var(--nx-leading-normal);
  letter-spacing: var(--nx-tracking-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.ap-intro__title,
.nx-ap-intro__title,
.campus-panel__title {
  font-family: var(--nx-font-display);
  letter-spacing: var(--nx-tracking-display);
  line-height: var(--nx-leading-display);
  font-weight: 600;
}

/* Explanatory copy — shared BEM suffixes across campus, services, calculator */
body.has-nx-shell [class$="__note"],
body.has-nx-shell [class$="-note"],
body.has-nx-shell [class$="__hint"],
body.has-nx-shell [class$="__desc"],
body.has-nx-shell [class$="__waiting"],
body.has-nx-shell [class$="__consent"],
body.has-nx-shell [class$="__once-sub"],
body.has-nx-shell [class$="__callout"],
body.has-nx-shell [class$="__revert"],
body.has-nx-shell [class$="__sub"],
body.has-nx-shell [class$="-sub"],
body.has-nx-shell [class$="__subtitle"],
body.has-nx-shell [class$="__body"],
body.has-nx-shell [class$="__support"],
body.has-nx-shell [class$="__lead"] {
  font-family: var(--nx-font-body);
  line-height: var(--nx-leading-relaxed);
  letter-spacing: 0.012em;
}

body.has-nx-shell [class$="__quote__note"],
body.has-nx-shell [class$="__fine"],
body.has-nx-shell [class$="__legal"],
body.has-nx-shell [class$="__disclaimer"] {
  font-family: var(--nx-font-body);
  line-height: var(--nx-leading-prose);
  letter-spacing: 0.01em;
}

/* Prices, metrics, step numbers — tabular figures so digits hold their column.
   Matched on the element suffix instead of hall by hall: the old list named
   only cloud and studio, which is why desk, sec and vault drifted off it. */
[class*="__fact-v"],
[class*="__price"],
[class*="__duel-sum"],
[class*="__bar-label"],
[class*="__step-num"],
[class*="__q-num"],
[class*="__journey-time"],
[class*="__estimate-v"],
[class*="__estimate-t"],
[class*="__meta"],
.campus-kpi .num {
  font-variant-numeric: tabular-nums;
}
.nx-cmd__item,
.nx-cmd__hub-label,
.nx-cmd__hub-sub,
.nx-deck__cta,
.nx-deck__phone,
.btn-nexus,
.nx-mega__card-title,
.nx-mega__card-num,
.nx-mega__card-price {
  font-family: var(--nx-font-body);
}

/* Variant-scoped header typography overrides live in shell.css */

body > main,
body > .footer,
body > .nx-footer {
  position: relative;
  z-index: 2;
}

body > .nx-shell {
  position: fixed;
  z-index: 500;
}
body.has-nx-shell > .nx-shell.is-console-open {
  z-index: 580;
}

body.has-nx-shell > .skip-link {
  position: fixed;
  top: auto;
  left: -9999px;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  z-index: 9999;
}
body.has-nx-shell > .skip-link:focus {
  top: 12px;
  left: 12px;
  width: auto;
  height: auto;
  padding: 10px 20px;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border-radius: var(--nx-radius-md);
  background: var(--campus-glass-strong);
  color: var(--text-primary);
  border: 1px solid var(--nx-border-strong);
  backdrop-filter: blur(16px);
}

body.has-nx-shell .section-wrap,
body.has-nx-shell .articles-page .ap-outro .container {
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

body.has-nx-shell .section-wrap {
  padding-left: var(--nx-gutter);
  padding-right: var(--nx-gutter);
}

body.has-nx-shell .nx-footer {
  width: 100%;
  box-sizing: border-box;
  padding-left: var(--nx-gutter);
  padding-right: var(--nx-gutter);
}
body.has-nx-shell .nx-footer__inner {
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
}

/* Primary CTA — glass campus */
.btn-nexus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  font-family: var(--nx-font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--nx-on-accent);
  background: var(--nx-accent);
  border: 1px solid transparent;
  border-radius: var(--nx-radius-orb);
  box-shadow: 0 8px 28px var(--nx-accent-glow);
  transition: background 280ms var(--nx-ease-out), transform 280ms var(--nx-ease-out), box-shadow 280ms;
  cursor: pointer;
  text-decoration: none;
}
.btn-nexus:hover {
  color: var(--nx-on-accent);
  background: var(--nx-accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px var(--nx-accent-glow-strong);
}
.btn-nexus--ghost {
  background: var(--campus-glass);
  color: var(--campus-ink);
  border: 1px solid var(--nx-border-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: none;
}
.btn-nexus--ghost:hover {
  color: var(--campus-ink);
  border-color: var(--campus-ink);
  background: var(--campus-glass-strong);
  box-shadow: none;
}

.nx-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--nx-font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--campus-mark, var(--text-muted));
  margin-bottom: 12px;
}
.nx-eyebrow::before {
  content: '';
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}
.nx-eyebrow::after { display: none; }

.highlight,
.campus-loc__title .accent {
  color: inherit;
  font-weight: 600;
}
