/* =============================================================
   Haevek site — page-level styles built on tokens.css
   Aesthetic: editorial-technical. Light canvas, near-black ink,
   gradient deployed as a single accent per surface.
   ============================================================= */

:root {
  /* Local site overrides — warmer cream canvas, deeper ink */
  --site-bg: #FAFAF7;
  --site-bg-2: #F2F0EA;
  --site-ink: #0E0B14;
  --site-ink-2: #2A2138;
  --site-ink-3: #6C6275;
  --site-rule: #1A14201A;
  --site-rule-strong: #1A1420;
  --site-max: 1200px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--site-bg);
  color: var(--site-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-micro) var(--ease-out-quart);
}
a:hover { color: var(--brand-orange); }
img { max-width: 100%; display: block; }

::selection {
  background: var(--brand-purple);
  color: #fff;
}

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 32px;
}

.container-wide {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 32px;
}

.section {
  padding: 96px 0;
  position: relative;
}

.section-tight { padding: 64px 0; }

.section + .section {
  border-top: 1px solid var(--site-rule);
}

.section-ink {
  background: var(--ink-900);
  color: var(--fg-on-ink);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.section-ink + .section,
.section + .section-ink {
  border-top: none;
}

.section-ink > :not(.section-ink-gridtrail) {
  position: relative;
  z-index: 1;
}

.section-ink-gridtrail {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(121, 34, 240, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 34, 240, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: 0 0;
}

/* ---------- Type ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--site-ink-3);
  margin: 0 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.section-ink .eyebrow {
  color: var(--fg-on-ink-2);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--site-ink);
  margin: 0;
  text-wrap: balance;
}

.section-ink h1, .section-ink h2, .section-ink h3, .section-ink h4 {
  color: var(--fg-on-ink);
}

.h-display {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.96;
  letter-spacing: -0.025em;
}

.h1 {
  font-size: clamp(40px, 5.5vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-weight: 600;
}

.h2 {
  font-size: clamp(32px, 3.6vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.h3 {
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.lead {
  font-size: clamp(18px, 1.4vw, 22px);
  line-height: 1.5;
  color: var(--site-ink-2);
  max-width: 64ch;
  text-wrap: pretty;
}

.section-ink .lead { color: var(--fg-on-ink-2); }

.muted { color: var(--site-ink-3); }
.section-ink .muted { color: var(--fg-on-ink-3); }

/* The signature gradient text — used at most ONCE per page */
.brand-grad {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mono { font-family: var(--font-mono); font-feature-settings: "ss01"; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-micro) var(--ease-out-quart),
              color var(--dur-micro) var(--ease-out-quart),
              border-color var(--dur-micro) var(--ease-out-quart);
  white-space: nowrap;
  letter-spacing: -0.005em;
}

.btn-primary {
  background: var(--site-ink);
  color: #fff;
}
.btn-primary:hover { background: #000; }

.section-ink .btn-primary {
  background: #fff;
  color: var(--site-ink);
}
.section-ink .btn-primary:hover { background: #f0ece6; }

.btn-ghost {
  background: transparent;
  color: var(--site-ink);
  border-color: var(--site-rule-strong);
}
.btn-ghost:hover {
  background: var(--site-ink);
  color: #fff;
}
.section-ink .btn-ghost {
  color: var(--fg-on-ink);
  border-color: var(--ink-500);
}
.section-ink .btn-ghost:hover {
  background: var(--fg-on-ink);
  color: var(--ink-900);
  border-color: var(--fg-on-ink);
}

.btn-link {
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-weight: 500;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  padding-bottom: 2px;
}

.btn .arrow {
  transition: transform var(--dur-micro) var(--ease-out-quart);
}
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 247, 0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--site-rule);
}

.nav-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.nav-brand img {
  height: 26px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-size: 14px;
  color: var(--site-ink-2);
  font-weight: 500;
  position: relative;
  padding: 8px 0;
  transition: color var(--dur-micro);
}
.nav-links a:hover { color: var(--site-ink); }
.nav-links a.active {
  color: var(--site-ink);
}
.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--site-ink);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-cta .btn {
  padding: 10px 16px;
  font-size: 14px;
}

/* Nav menu button */
.nav-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--site-rule-strong);
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 5px 9px;
  transition: border-color var(--dur-micro), color var(--dur-micro);
}
.nav-menu-btn .nav-menu-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--site-ink);
  white-space: nowrap;
}
.nav-menu-btn:hover { border-color: var(--site-ink-3); }
.nav-menu-btn.open { border-color: var(--site-ink-3); }

/* Mobile drawer */
.nav-drawer {
  display: none;
  background: rgba(250, 250, 247, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--site-rule);
}
.nav-drawer.open { display: block; }
.nav-drawer-links {
  display: flex;
  flex-direction: column;
  padding: 0 20px;
}
.nav-drawer-links a {
  font-size: 17px;
  font-weight: 500;
  color: var(--site-ink-2);
  padding: 15px 0;
  border-bottom: 1px solid var(--site-rule);
  transition: color var(--dur-micro);
  text-decoration: none;
  display: block;
}
.nav-drawer-links a:first-child { border-top: 1px solid var(--site-rule); }
.nav-drawer-links a:hover,
.nav-drawer-links a.active { color: var(--site-ink); }
.nav-drawer-cta {
  padding: 20px 20px 24px;
}
.nav-drawer-cta .btn {
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .nav-menu-btn { display: flex; }
}
@media (min-width: 861px) {
  .nav-drawer { display: none !important; }
}
@media (max-width: 520px) {
  .nav-inner { gap: 10px; }
}

/* ---------- Back to top ---------- */
.back-to-top {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 200;
  background: var(--site-ink);
  color: var(--site-bg);
  border: none;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 10px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
@media (max-width: 860px) {
  .back-to-top { display: block; }
}

/* ---------- Footer ---------- */
.footer {
  background: var(--ink-900);
  color: var(--fg-on-ink-2);
  padding: 80px 0 40px;
  font-size: 14px;
}
.footer h5 {
  color: var(--fg-on-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  margin: 0 0 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 64px;
}
.footer-brand img {
  height: 28px;
  margin-bottom: 16px;
}
.footer-brand p {
  max-width: 30ch;
  color: var(--fg-on-ink-3);
  line-height: 1.55;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-col a {
  color: var(--fg-on-ink-2);
  transition: color var(--dur-micro);
}
.footer-col a:hover { color: var(--fg-on-ink); }
.footer-bottom {
  border-top: 1px solid var(--ink-700);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-on-ink-3);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand { grid-column: span 2; }
}

/* ---------- Generic blocks ---------- */
.divider-rule {
  height: 1px;
  background: var(--site-rule);
  margin: 0;
  border: 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid var(--site-rule-strong);
  border-radius: 999px;
  color: var(--site-ink-2);
}
.section-ink .tag {
  border-color: var(--ink-500);
  color: var(--fg-on-ink-2);
}

/* Number meta line — used on pages: section number + label */
.section-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--site-ink-3);
  margin-bottom: 32px;
}
.section-meta .num {
  font-weight: 500;
  color: var(--site-ink);
}
.section-ink .section-meta .num { color: var(--fg-on-ink); }
.section-meta .bar {
  flex: 1;
  height: 1px;
  background: var(--site-rule);
}
.section-ink .section-meta .bar { background: var(--ink-500); }

/* Card */
.card {
  background: #fff;
  border: 1px solid var(--site-rule);
  border-radius: 8px;
  padding: 28px;
}
.section-ink .card {
  background: var(--ink-800);
  border-color: var(--ink-700);
}

/* ═══════════════════════════════════════════════════════════
   Haevek animation system v4 — data-processing aesthetic
   Precise, fast. No decorative hover effects.
   Left→right scan reveals. Top→bottom stagger ordering.
   ═══════════════════════════════════════════════════════════ */

/* Headings are not interactive — default cursor always */
h1, h2, h3, h4, h5, h6 { cursor: default; }

/* Typewriter cursor — blinks like a terminal */
.tw-cursor {
  display: inline-block;
  width: 2px;
  height: 0.78em;
  background: currentColor;
  margin-left: 1px;
  vertical-align: middle;
  animation: tw-blink 0.65s step-end infinite;
}
@keyframes tw-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Above-fold initial states — set synchronously by JS (anim-init class)
   Prevents flash-of-unstyled-content on hero elements */

/* Home hero lines: clip from left (scan reveal) */
html.anim-init .hero h1 .line {
  clip-path: inset(0 100% 0 0);
  opacity: 1;
}
html.anim-init .hero-meta {
  opacity: 0;
}
html.anim-init .hero-actions {
  opacity: 0;
}
html.anim-init .hero-spec > div {
  opacity: 0;
}

/* Product hero */
html.anim-init .product-hero h1 {
  clip-path: inset(0 100% 0 0);
  opacity: 1;
}
html.anim-init .product-hero .eyebrow,
html.anim-init .product-hero .lead,
html.anim-init .product-hero .actions {
  opacity: 0;
}

/* Generic page hero */
html.anim-init .page-hero h1,
html.anim-init .pl-hero h1 {
  clip-path: inset(0 100% 0 0);
  opacity: 1;
}
html.anim-init .page-hero .eyebrow,
html.anim-init .page-hero .lead,
html.anim-init .pl-hero .eyebrow,
html.anim-init .pl-hero .lead {
  opacity: 0;
}

/* Legacy: .reveal kept for any remaining uses */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 420ms var(--ease-out-quart),
              transform 420ms var(--ease-out-quart);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* Legacy motion-enter kept inert (no motion-ready class assigned) */
.motion-ready .motion-enter {
  opacity: 0;
  transform: translate3d(0, var(--motion-y, 18px), 0);
  transition:
    opacity 400ms var(--ease-out-quart),
    transform 400ms var(--ease-out-quart);
  transition-delay: var(--motion-delay, 0ms);
}
.motion-ready .motion-enter.in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

@media (prefers-reduced-motion: reduce) {
  html.anim-init .hero h1 .line,
  html.anim-init .product-hero h1,
  html.anim-init .page-hero h1,
  html.anim-init .pl-hero h1 {
    clip-path: none;
    opacity: 1;
  }
  html.anim-init .hero-meta,
  html.anim-init .hero-actions,
  html.anim-init .hero-spec > div,
  html.anim-init .product-hero .eyebrow,
  html.anim-init .product-hero .lead,
  html.anim-init .product-hero .actions,
  html.anim-init .page-hero .eyebrow,
  html.anim-init .page-hero .lead,
  html.anim-init .pl-hero .eyebrow,
  html.anim-init .pl-hero .lead {
    opacity: 1;
  }
  .reveal,
  .motion-ready .motion-enter {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Big numerals */
.numeral {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(64px, 9vw, 140px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.numeral .unit {
  font-size: 0.5em;
  font-weight: 500;
  color: var(--site-ink-3);
  letter-spacing: -0.02em;
  margin-left: 4px;
}
.section-ink .numeral .unit { color: var(--fg-on-ink-3); }

/* Small grid utilities */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section { padding: 64px 0; }
  .container, .container-wide { padding: 0 20px; }
  .section-meta { margin-bottom: 18px; }
  .page-hero { padding: 40px 0 48px; }
}

/* Marquee-style logo strip */
.logo-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  align-items: center;
}
.logo-strip > div {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--site-ink-2);
  opacity: 0.7;
  font-size: 18px;
  border-left: 1px solid var(--site-rule);
  padding-left: 16px;
}
.logo-strip > div:first-child { border-left: 0; padding-left: 0; }
@media (max-width: 860px) {
  .logo-strip { grid-template-columns: repeat(2, 1fr); gap: 32px 16px; }
  .logo-strip > div { border-left: 0; padding-left: 0; justify-content: flex-start; }
}

/* Hairline frame for hero-style figures */
.frame {
  border: 1px solid var(--site-rule-strong);
  background: #fff;
  position: relative;
}
.frame::before, .frame::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--site-ink);
}
.frame.with-corners::before { top: -4px; left: -4px; }
.frame.with-corners::after { bottom: -4px; right: -4px; }

/* Page hero common */
.page-hero {
  padding: 120px 0 80px;
  border-bottom: 1px solid var(--site-rule);
}
.page-hero .eyebrow { margin-bottom: 24px; }
.page-hero h1 { margin-bottom: 24px; }
.page-hero .lead { max-width: 60ch; }
