/* ==========================================================================
   Systema HR — Base layer
   Reset, the four-layer ambient background, typography and layout primitives.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Anchor targets clear the sticky header. */
    scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
    margin: 0;
    min-height: 100%;
    background-color: var(--bg-base);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: var(--text-body);
    line-height: var(--leading-relaxed);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body.is-locked {
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, ul, ol, dl {
    margin: 0;
}

ul[class], ol[class] {
    list-style: none;
    padding: 0;
}

img, video, svg, picture {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
    cursor: pointer;
}

address {
    font-style: normal;
}

hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-hover), transparent);
    margin: 0;
}

::selection {
    background: rgba(var(--accent-rgb), 0.35);
    color: #fff;
}

/* Focus: always visible, accent-coloured, offset against the page canvas. */
:focus-visible {
    outline: 2px solid rgba(var(--accent-rgb), 0.7);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* Keyboard affordance: lets someone tabbing through the page jump past the
   navigation straight to #main. Hidden until focused.

   position: fixed, not absolute — an absolutely positioned skip link is
   anchored to the top of the *document*, so once the page is scrolled it can
   never appear on screen even when focused, which defeats the point.

   It is parked with an explicit -100px offset rather than a percentage of its
   own height, so nothing depends on the element having resolved its box.
   opacity + visibility guarantee it is gone even if the offset is ever
   defeated by a positioning context. */
.skip-link {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    padding: 0.75rem 1.25rem;
    background: var(--accent);
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-accent);
    opacity: 0;
    visibility: hidden;
    transition:
        top var(--dur-quick) var(--ease-expo),
        opacity var(--dur-quick) var(--ease-out),
        visibility 0s linear var(--dur-quick);
}

.skip-link:focus,
.skip-link:focus-visible {
    top: 0;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   2. Ambient background — four stacked layers, none dominant
   -------------------------------------------------------------------------- */
.ambient {
    position: fixed;
    inset: 0;
    z-index: var(--z-ambient);
    pointer-events: none;
    overflow: hidden;
    /* Layer 1 — vertical depth from a top-centre radial. */
    background: radial-gradient(ellipse at top, #0a0a0f 0%, var(--bg-base) 50%, var(--bg-deep) 100%);
}

/* Layer 2 — noise. Adds tactility and kills gradient banding. */
.ambient__noise {
    position: absolute;
    inset: -50%;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Layer 3 — floating light pools. */
.ambient__blob {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

.ambient__blob--1 {
    top: -420px;
    left: 50%;
    width: 900px;
    height: 1400px;
    margin-left: -450px;
    background: var(--ambient-1);
    filter: blur(150px);
    animation: ds-float var(--dur-float) ease-in-out infinite;
}

.ambient__blob--2 {
    top: 22%;
    left: -240px;
    width: 600px;
    height: 800px;
    background: var(--ambient-2);
    filter: blur(120px);
    animation: ds-float 10500ms ease-in-out infinite;
    animation-delay: -2500ms;
}

.ambient__blob--3 {
    top: 48%;
    right: -200px;
    width: 500px;
    height: 700px;
    background: var(--ambient-3);
    filter: blur(100px);
    animation: ds-float 8200ms ease-in-out infinite;
    animation-delay: -4000ms;
}

.ambient__blob--4 {
    bottom: -260px;
    left: 30%;
    width: 700px;
    height: 600px;
    background: var(--ambient-4);
    filter: blur(130px);
    animation: ds-pulse 9500ms ease-in-out infinite;
}

@keyframes ds-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-20px) rotate(1deg); }
}

@keyframes ds-pulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.06); }
}

/* Layer 4 — 64px technical grid. */
.ambient__grid {
    position: absolute;
    inset: 0;
    opacity: 0.02;
    background-image:
        linear-gradient(to right, #fff 1px, transparent 1px),
        linear-gradient(to bottom, #fff 1px, transparent 1px);
    background-size: 64px 64px;
    /* Fade the grid out toward the bottom so it reads as atmosphere, not chrome. */
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
}

@media (prefers-reduced-motion: reduce) {
    .ambient__blob {
        animation: none !important;
    }
}

/* Blobs are expensive to blur on low-end mobile GPUs — shrink and simplify. */
@media (max-width: 767px) {
    .ambient__blob--1 { width: 560px; height: 800px; margin-left: -280px; filter: blur(110px); }
    .ambient__blob--2 { width: 380px; height: 500px; filter: blur(90px); }
    .ambient__blob--3 { display: none; }
    .ambient__blob--4 { width: 420px; height: 380px; filter: blur(90px); }
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.page {
    position: relative;
    z-index: var(--z-content);
}

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.container--wide {
    max-width: var(--container-wide);
}

.container--narrow {
    max-width: 820px;
}

.section {
    position: relative;
    padding-block: var(--section-y);
}

.section--sm {
    padding-block: var(--section-y-sm);
}

.section--flush-top {
    padding-top: 0;
}

.section--flush-bottom {
    padding-bottom: 0;
}

/* Hairline rule between sections. */
.section--divided {
    border-top: 1px solid var(--border);
}

/* Gradient accent line — softer alternative to a full-width border. */
.rule {
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
    border: 0;
}

.stack > * + * {
    margin-top: var(--stack-gap, 1rem);
}

/* --------------------------------------------------------------------------
   4. Typography
   -------------------------------------------------------------------------- */
.display {
    font-size: var(--text-page-title);
    font-weight: 600;
    letter-spacing: var(--tracking-display);
    line-height: var(--leading-none);
}

.h1 {
    font-size: var(--text-h1);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
}

.h2 {
    font-size: var(--text-h2);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
}

.h3 {
    font-size: var(--text-h3);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-snug);
}

.lead {
    font-size: var(--text-lead);
    line-height: var(--leading-relaxed);
    color: var(--fg-muted);
}

.body {
    font-size: var(--text-body);
    line-height: var(--leading-relaxed);
    color: var(--fg-muted);
}

.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }

/* Section eyebrow — mono, wide-tracked, uppercase. */
.label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: var(--text-label);
    font-weight: 500;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--fg-muted);
}

.label::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.label--plain::before {
    display: none;
}

/* Vertical gradient fill gives headlines dimensionality.
   The falloff stops at 82% rather than 70%: on a headline that wraps to two
   or three lines the steeper ramp left the final line looking washed out. */
.text-gradient {
    background: linear-gradient(to bottom, #fff 0%, rgba(255, 255, 255, 0.97) 55%, rgba(255, 255, 255, 0.82) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    /* Descenders get clipped without a little breathing room. */
    padding-bottom: 0.08em;
}

/* Animated accent sweep for the key phrase in a headline. */
.text-accent-gradient {
    background: linear-gradient(90deg, var(--accent) 0%, #8ea9f5 50%, var(--accent) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: ds-shimmer 6s linear infinite;
    padding-bottom: 0.08em;
}

@keyframes ds-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .text-accent-gradient { animation: none; }
}

/* --------------------------------------------------------------------------
   5. Rich text — renders admin-authored HTML from programs/solutions.big_text
   -------------------------------------------------------------------------- */
.prose {
    color: var(--fg-muted);
    font-size: var(--text-lead);
    line-height: var(--leading-relaxed);
}

.prose > * + * { margin-top: 1.25em; }

/* Justified measure for running body copy, matching the original site.
   Hyphenation is not optional here — justifying without it tears rivers of
   white space through the paragraph at these column widths. Centred blocks
   are excluded so the alignment isn't fighting itself. */
.prose p,
.prose li,
.lead {
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
}

.section-head--center .lead,
.text-center .lead {
    text-align: center;
    -webkit-hyphens: manual;
    hyphens: manual;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
    color: var(--fg);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-snug);
    margin-top: 2em;
}

.prose h1 { font-size: var(--text-h2); }
.prose h2 { font-size: var(--text-h3); }
.prose h3, .prose h4 { font-size: 1.125rem; }

.prose > :first-child { margin-top: 0; }

.prose strong, .prose b { color: var(--fg); font-weight: 600; }

.prose a {
    color: var(--accent-bright);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(var(--accent-rgb), 0.4);
    transition: text-decoration-color var(--dur-quick) var(--ease-out);
}

.prose a:hover { text-decoration-color: var(--accent-bright); }

.prose ul, .prose ol {
    padding-left: 1.25rem;
    display: grid;
    gap: 0.6rem;
}

.prose ul { list-style: none; padding-left: 0; }

.prose ul > li {
    position: relative;
    padding-left: 1.65rem;
}

.prose ul > li::before {
    content: "";
    position: absolute;
    left: 0.25rem;
    top: 0.72em;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.prose ol > li::marker { color: var(--accent); font-variant-numeric: tabular-nums; }

.prose img {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
}

.prose blockquote {
    padding-left: 1.5rem;
    border-left: 2px solid var(--border-accent);
    color: var(--fg-subtle);
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.prose th, .prose td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.prose th { color: var(--fg); font-weight: 600; }

/* --------------------------------------------------------------------------
   6. Scroll reveal — opacity + tiny translate, staggered by data attribute
   -------------------------------------------------------------------------- */
[data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity var(--dur-enter) var(--ease-expo),
        transform var(--dur-enter) var(--ease-expo);
    transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal="scale"] {
    transform: translateY(0) scale(0.95);
}

[data-reveal].is-revealed {
    opacity: 1;
    transform: none;
}

/* If JS never runs, content must not stay invisible. */
.no-js [data-reveal] {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* --------------------------------------------------------------------------
   7. Small utilities
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }
.relative { position: relative; }
.full { width: 100%; }

.grid { display: grid; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
