/* ==========================================================================
   NEXA CODE — base.css
   01. Fonts
   02. Design tokens (ink / bone — strictly two colours + one light tone)
   03. Reset
   04. Typography
   05. Layout primitives
   06. Texture, grain, selection, focus
   07. Motion primitives & reveal system
   08. Accessibility
   ========================================================================== */

/* --------------------------------------------------------------------------
   01. FONTS — self-hosted, variable, cyrillic + latin subsets
   Licences: assets/fonts/*-OFL.txt
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Manrope';
  src: url('../fonts/manrope-cyrillic.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  src: url('../fonts/manrope-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Unbounded';
  src: url('../fonts/unbounded-cyrillic.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Unbounded';
  src: url('../fonts/unbounded-latin.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-cyrillic.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-latin.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Instrument Serif';
  src: url('../fonts/instrument-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-024F, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('../fonts/instrument-italic-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-024F, U+2000-206F, U+20AC, U+2122;
}

/* --------------------------------------------------------------------------
   02. DESIGN TOKENS

   The palette is deliberately narrow:
     ink   #080808  — the ground
     bone  #E9E5DA  — the single light tone
     paper #FFFFFF  — pure white light

   Every "grey" in the interface is an alpha of one of those three.
   No hue ever enters the system.
   -------------------------------------------------------------------------- */
:root {
  /* colour constants */
  --ink: #080808;
  --ink-2: #0d0d0d;
  --bone: #e9e5da;
  --bone-2: #e2ddd0;
  --paper: #ffffff;

  /* default scheme (ink) */
  --bg: var(--ink);
  --fg: #f4f2ec;
  --fg-muted: rgba(244, 242, 236, 0.56);
  --fg-faint: rgba(244, 242, 236, 0.48);
  --fg-ghost: rgba(244, 242, 236, 0.22);
  --line: rgba(244, 242, 236, 0.14);
  --line-soft: rgba(244, 242, 236, 0.08);
  --line-strong: rgba(244, 242, 236, 0.32);
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.07);
  --invert-bg: var(--bone);
  --invert-fg: var(--ink);
  --on-accent: var(--ink);

  /* type */
  --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;

  /* metrics */
  --header-h: 78px;
  --max-w: 1560px;
  --gutter: clamp(18px, 4.4vw, 72px);
  --radius: 3px;
  --radius-lg: 6px;

  /* motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-1: 180ms;
  --dur-2: 320ms;
  --dur-3: 560ms;
  --dur-4: 900ms;

  color-scheme: dark;
  accent-color: var(--bone);
}

/* inverted scheme */
html[data-theme='bone'] {
  --bg: var(--bone);
  --fg: var(--ink);
  --fg-muted: rgba(8, 8, 8, 0.62);
  --fg-faint: rgba(8, 8, 8, 0.55);
  --fg-ghost: rgba(8, 8, 8, 0.18);
  --line: rgba(8, 8, 8, 0.16);
  --line-soft: rgba(8, 8, 8, 0.09);
  --line-strong: rgba(8, 8, 8, 0.34);
  --surface: rgba(8, 8, 8, 0.04);
  --surface-2: rgba(8, 8, 8, 0.08);
  --invert-bg: var(--ink);
  --invert-fg: var(--bone);
  --on-accent: var(--bone);
  color-scheme: light;
}

/* explicit surface schemes — always stable regardless of the theme switch */
.scheme-ink {
  --bg: var(--ink);
  --fg: #f4f2ec;
  --fg-muted: rgba(244, 242, 236, 0.56);
  --fg-faint: rgba(244, 242, 236, 0.48);
  --fg-ghost: rgba(244, 242, 236, 0.22);
  --line: rgba(244, 242, 236, 0.14);
  --line-soft: rgba(244, 242, 236, 0.08);
  --line-strong: rgba(244, 242, 236, 0.32);
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.07);
  --invert-bg: var(--bone);
  --invert-fg: var(--ink);
  --on-accent: var(--ink);
  background: var(--bg);
  color: var(--fg);
}
.scheme-bone {
  --bg: var(--bone);
  --fg: var(--ink);
  --fg-muted: rgba(8, 8, 8, 0.62);
  --fg-faint: rgba(8, 8, 8, 0.55);
  --fg-ghost: rgba(8, 8, 8, 0.18);
  --line: rgba(8, 8, 8, 0.16);
  --line-soft: rgba(8, 8, 8, 0.09);
  --line-strong: rgba(8, 8, 8, 0.34);
  --surface: rgba(8, 8, 8, 0.04);
  --surface-2: rgba(8, 8, 8, 0.08);
  --invert-bg: var(--ink);
  --invert-fg: var(--bone);
  --on-accent: var(--bone);
  background: var(--bg);
  color: var(--fg);
}

/* --------------------------------------------------------------------------
   03. RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 500ms var(--ease), color 500ms var(--ease);
}

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

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img,
svg,
canvas,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

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

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

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

input,
textarea,
select {
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  resize: vertical;
}

table {
  border-collapse: collapse;
}

::selection {
  background: var(--bone);
  color: var(--ink);
}
.scheme-bone ::selection {
  background: var(--ink);
  color: var(--bone);
}
html[data-theme='bone'] ::selection {
  background: var(--ink);
  color: var(--bone);
}

/* --------------------------------------------------------------------------
   04. TYPOGRAPHY
   -------------------------------------------------------------------------- */
.display {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: -0.045em;
  line-height: 0.94;
  text-wrap: balance;
}

.serif {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.005em;
  font-size: 1.06em;
  line-height: 0.9;
}

.mono {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-feature-settings: 'zero' 1;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
  line-height: 1.4;
}
.eyebrow::before {
  content: '';
  width: 26px;
  height: 1px;
  background: currentColor;
  flex: none;
  opacity: 0.7;
}
.eyebrow--bare::before {
  display: none;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(34px, 4.8vw, 72px);
  line-height: 0.97;
  letter-spacing: -0.05em;
  margin-top: 22px;
  text-wrap: balance;
}

.section-lead {
  font-size: clamp(15px, 1.25vw, 18px);
  line-height: 1.65;
  color: var(--fg-muted);
  max-width: 44ch;
}

.muted {
  color: var(--fg-muted);
}
.faint {
  color: var(--fg-faint);
}
.ghost-text {
  color: var(--fg-ghost);
}

.outline-text {
  color: transparent;
  -webkit-text-stroke: 1px var(--fg);
  text-stroke: 1px var(--fg);
}
html[data-theme='bone'] .outline-text {
  -webkit-text-stroke-color: var(--ink);
}

strong,
b {
  font-weight: 600;
}

em {
  font-style: italic;
}

/* animated underline for inline links */
.u-link {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding-bottom: 2px;
  color: inherit;
}
.u-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 420ms var(--ease);
}
.u-link:hover::after,
.u-link:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* --------------------------------------------------------------------------
   05. LAYOUT PRIMITIVES
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow {
  max-width: 1080px;
}

.section {
  position: relative;
  padding-block: clamp(72px, 10vw, 148px);
}

.section--tight {
  padding-block: clamp(48px, 6vw, 88px);
}

.rule {
  height: 1px;
  width: 100%;
  background: var(--line);
  border: 0;
  margin: 0;
}

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  gap: clamp(24px, 5vw, 96px);
  align-items: end;
  margin-bottom: clamp(40px, 6vw, 88px);
}
.section-head__aside {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 6px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.meta-row__dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   06. TEXTURE / GRAIN
   -------------------------------------------------------------------------- */
.grain {
  position: fixed;
  inset: -20%;
  z-index: 60;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 8s steps(6) infinite;
  will-change: transform;
}
html[data-theme='bone'] .grain {
  opacity: 0.045;
  mix-blend-mode: multiply;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 1%); }
  100% { transform: translate(0, 0); }
}

/* hairline technical grid used behind hero + lab */
.tech-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, var(--line-soft) 1px, transparent 1px);
  background-size: calc(100% / 6) 100%;
  opacity: 0.75;
  mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 82%, transparent);
}

.noise-band {
  position: relative;
  isolation: isolate;
}
.noise-band::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.5;
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(255, 255, 255, 0.05), transparent 60%),
    radial-gradient(90% 70% at 90% 100%, rgba(255, 255, 255, 0.035), transparent 55%);
}
.scheme-bone.noise-band::after {
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(0, 0, 0, 0.05), transparent 60%),
    radial-gradient(90% 70% at 90% 100%, rgba(0, 0, 0, 0.035), transparent 55%);
}

/* --------------------------------------------------------------------------
   07. MOTION PRIMITIVES
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity 900ms var(--ease),
    transform 1000ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal='fade'] {
  transform: none;
}
[data-reveal='left'] {
  transform: translate3d(-32px, 0, 0);
}
[data-reveal='right'] {
  transform: translate3d(32px, 0, 0);
}
[data-reveal='scale'] {
  transform: scale(0.965);
}
[data-reveal].is-in {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* masked line reveal — span wrapped in .line-mask > .line-inner */
.line-mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}
.line-inner {
  display: block;
  transform: translate3d(0, 110%, 0) rotate(1.2deg);
  transform-origin: left top;
  transition: transform 1100ms var(--ease);
  transition-delay: var(--line-delay, 0ms);
}
.is-in .line-inner,
[data-reveal].is-in .line-inner {
  transform: none;
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}
@keyframes marquee-x {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   08. ACCESSIBILITY
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
:focus:not(:focus-visible) {
  outline: none;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -120px;
  left: 16px;
  z-index: 1000;
  padding: 14px 20px;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 2px;
  transition: top 260ms var(--ease);
}
.skip-link:focus {
  top: 14px;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal],
  .line-inner {
    opacity: 1 !important;
    transform: none !important;
  }
  .grain {
    animation: none;
  }
}

@media print {
  .grain,
  .site-header,
  .cursor,
  .scroll-progress,
  .marquee,
  .site-footer__base nav {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
}
