/* ============================================================
   Niko — Base
   Shared variables, reset, ambient, nav, buttons, footer.
   Loaded by every page.
   ============================================================ */

:root {
  /* Palette — dark (primary) */
  --bg: #0A0A0A;
  --bg-soft: #141416;
  --ink: #F5F5F7;
  --ink-mid: #86868B;
  --forest: #52B788;
  --blue: #5B8DEF;
  --hairline: rgba(245, 245, 247, 0.10);
  --hairline-strong: rgba(245, 245, 247, 0.18);

  /* Type */
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, "Menlo", "Consolas", monospace;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Layout */
  --maxw: 1200px;
  --readw: 720px;
  --pad-x: clamp(20px, 4vw, 48px);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga", "ss01";
  transition: background 400ms var(--ease), color 400ms var(--ease);
  position: relative;
  overflow-x: hidden;
}

/* ============================================================
   Ambient background
   ============================================================ */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  /* Major/minor graticule grid */
  background-image:
    linear-gradient(to right, var(--hairline-strong) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hairline-strong) 1px, transparent 1px),
    linear-gradient(to right, var(--hairline) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hairline) 1px, transparent 1px);
  background-size: 400px 400px, 400px 400px, 80px 80px, 80px 80px;
  background-position: -1px -1px, -1px -1px, -1px -1px, -1px -1px;
  opacity: 1;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 40%, transparent 92%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 40%, transparent 92%);
}
.ambient::before,
.ambient::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}
.ambient::before {
  width: 70vmax; height: 70vmax;
  left: -18vmax; top: -22vmax;
  background: radial-gradient(circle, color-mix(in oklab, var(--forest) 60%, transparent) 0%, color-mix(in oklab, var(--forest) 18%, transparent) 45%, transparent 70%);
  opacity: 0.55;
  animation: drift-a 32s ease-in-out infinite alternate;
}
.ambient::after {
  width: 65vmax; height: 65vmax;
  right: -16vmax; bottom: -24vmax;
  background: radial-gradient(circle, color-mix(in oklab, var(--blue) 55%, transparent) 0%, color-mix(in oklab, var(--blue) 16%, transparent) 45%, transparent 70%);
  opacity: 0.5;
  animation: drift-b 38s ease-in-out infinite alternate;
}
@keyframes drift-a {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(10vmax, 7vmax) scale(1.12); }
}
@keyframes drift-b {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-8vmax, -5vmax) scale(1.14); }
}
.ambient-noise {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  pointer-events: none;
}
.ambient-contours {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
}
.ambient-contours path {
  fill: none;
  stroke: var(--forest);
  stroke-width: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  .ambient::before, .ambient::after { animation: none; }
}

/* Quiet variant — graticule grid + green hue, no blue orb */
.ambient-quiet::after { display: none; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--forest); color: var(--bg); }

/* Focus ring */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Containers */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

.measure { max-width: var(--readw); }

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 300ms var(--ease), background 300ms var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--hairline); }

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

.monogram {
  display: inline-flex;
  align-items: center;
  height: 28px;
  gap: 8px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink);
}
.monogram-mark {
  width: 28px; height: 28px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
  padding: 0; margin: 0;
  font-size: 14px;
  font-weight: 500;
}
.nav-links li { display: flex; align-items: center; height: 28px; }
.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 28px;
  gap: 8px;
  color: var(--ink);
  opacity: 0.78;
  transition: opacity 150ms var(--ease), color 150ms var(--ease);
}
.nav-label {
  display: inline-flex;
  align-items: center;
  height: 28px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
}
.nav-icon-frame {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.nav-mark {
  width: 28px;
  height: 28px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
  flex-shrink: 0;
}
.nav-links a:hover { opacity: 1; color: var(--blue); }
.nav-links a.is-active {
  opacity: 1;
  color: var(--forest);
}
.nav-links a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -8px;
  height: 2px;
  background: var(--forest);
}

.nav-right { display: flex; align-items: center; gap: 20px; }

@media (max-width: 640px) {
  .nav-links { gap: 20px; }
  .nav-links a { font-size: 13px; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all 200ms var(--ease);
  border: 1px solid transparent;
  font-family: inherit;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  transform: translateY(-1px);
  background: color-mix(in oklab, var(--ink) 90%, var(--blue));
}
.btn-ghost {
  background: var(--bg-soft);
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn-ghost:hover {
  border-color: var(--ink);
  background: color-mix(in oklab, var(--bg-soft) 70%, var(--ink) 30%);
  color: var(--blue);
}
.btn .arrow { transition: transform 200ms var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  padding: 48px 0 56px;
}
.footer-inner {
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: clamp(24px, 3vw, 32px) clamp(24px, 4vw, 40px);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-links {
  display: flex; gap: 28px;
  list-style: none;
  padding: 0; margin: 0;
  font-size: 14px;
  color: var(--ink-mid);
}
.footer-links a { transition: color 150ms var(--ease); }
.footer-links a:hover { color: var(--ink); }
.footer-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-mid);
  text-transform: uppercase;
}
.back-to-top {
  font-size: 14px;
  color: var(--ink-mid);
  display: inline-flex; align-items: center; gap: 6px;
  transition: color 150ms var(--ease);
}
.back-to-top:hover { color: var(--ink); }

/* ============================================================
   Section heads (shared across pages)
   ============================================================ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(32px, 5vw, 56px);
  padding-top: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--forest);
}
.section-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-mid);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.section-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(40px, 6vw, 72px);
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}

/* ============================================================
   Scroll animation helpers
   ============================================================ */
.reveal {
  will-change: opacity, transform;
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
}
