/* ==========================================================================
   Base — reset, type defaults and the page ground.
   The intranet's base layer (globals.css @layer base) for a portal without
   Tailwind: paper by default, ink under .dark, Inter for text, Manrope for
   headings, and the fixed blue glows and grain of .app-ground behind every page.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; border-color: hsl(var(--border)); }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  font-size: var(--font-size);
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}
html.dark { color-scheme: dark; }

body {
  font-family: var(--font-sans);
  font-weight: var(--weight-normal);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  font-feature-settings: "rlig" 1, "calt" 1;
  font-variant-numeric: proportional-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* The page ground: the intranet's .app-ground on the body itself — three soft
   brand-blue lights, fixed so they do not travel with the scroll, and a grain
   layer that stops the large gradients banding. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    radial-gradient(60vmax 46vmax at 12% -8%, rgba(33, 173, 242, 0.16), transparent 70%),
    radial-gradient(52vmax 40vmax at 96% 4%, rgba(75, 125, 255, 0.12), transparent 72%),
    radial-gradient(46vmax 46vmax at 60% 108%, rgba(101, 220, 255, 0.1), transparent 70%);
}
.dark body::before {
  background-image:
    radial-gradient(60vmax 46vmax at 12% -8%, rgba(33, 173, 242, 0.12), transparent 70%),
    radial-gradient(52vmax 40vmax at 96% 4%, rgba(75, 125, 255, 0.1), transparent 72%),
    radial-gradient(46vmax 46vmax at 60% 108%, rgba(101, 220, 255, 0.08), transparent 70%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
}

/* The old per-page glow layer: the ground above replaces it. */
.page-glow { display: none; }

/* Headings — Manrope, tracked in the way the brand's display scale is. */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  letter-spacing: -0.025em;
  line-height: var(--leading-tight);
  color: hsl(var(--foreground));
}

h1 { font-size: clamp(1.75rem, 3vw, 2.125rem); font-weight: var(--weight-extrabold); letter-spacing: -0.035em; line-height: 1.08; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }
h5 { font-size: var(--text-body); }
h6 { font-size: var(--text-sm); }

p { margin: 0; line-height: var(--leading-relaxed); }

a {
  color: hsl(var(--primary));
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}
a:hover { text-decoration: underline; text-underline-offset: 4px; }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

hr {
  border: 0;
  border-top: 1px solid hsl(var(--border));
  margin: var(--space-8) 0;
}

::selection {
  background: hsl(var(--primary) / 0.2);
  color: inherit;
}

/* Focus ring: the token ring, offset from the ground. */
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Utilities (small, scoped) */
.mono       { font-family: var(--font-mono); }
.metric     { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tabular    { font-variant-numeric: tabular-nums; }
.muted      { color: hsl(var(--muted-foreground)); }
.uppercase  { text-transform: uppercase; letter-spacing: var(--tracking-widest); }
.center     { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.container  { max-width: var(--container-7xl); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-8); }

/* Hidden when role-gating removes an element from view */
[data-role-gate][hidden] { display: none !important; }
