/* ============================================================
   DENSITY FREIGHT INC. — Design System
   Bold editorial · Swiss-industrial · photo-free
   ============================================================ */

/* ---------- Fonts (Fontshare) ---------- */
@import url('https://api.fontshare.com/v2/css?f[]=clash-display@400,500,600,700&f[]=satoshi@400,500,700&f[]=jetbrains-mono@400,500&display=swap');

/* ---------- Tokens ---------- */
:root {
  /* Palette — OKLCH. Paper + ink + committed logo red */
  --paper:        oklch(0.97 0.004 90);      /* true off-white, near-neutral */
  --paper-2:      oklch(0.94 0.005 90);      /* faint panel */
  --ink:          oklch(0.18 0.012 265);     /* near-black, cool */
  --ink-2:        oklch(0.34 0.012 265);     /* secondary text — AA on paper */
  --ink-soft:     oklch(0.46 0.010 265);     /* muted, still AA on paper */
  --line:         oklch(0.18 0.012 265 / 0.14);
  --line-strong:  oklch(0.18 0.012 265 / 0.28);

  --red:          oklch(0.55 0.20 27);       /* logo red, signal */
  --red-deep:     oklch(0.47 0.19 27);       /* pressed / drenched */
  --red-ink:      oklch(0.30 0.12 27);       /* text on red-tint */

  /* Dark surfaces (footer / drenched blocks) */
  --night:        oklch(0.19 0.014 265);
  --night-2:      oklch(0.24 0.014 265);
  --on-night:     oklch(0.96 0.004 90);
  --on-night-soft: oklch(0.72 0.008 265);

  /* Type */
  --font-display: 'Clash Display', 'Arial Narrow', sans-serif;
  --font-body:    'Satoshi', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* Fluid scale (1.25) */
  --step--1: clamp(0.78rem, 0.75rem + 0.15vw, 0.86rem);
  --step-0:  clamp(0.95rem, 0.90rem + 0.25vw, 1.06rem);
  --step-1:  clamp(1.18rem, 1.08rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.6rem, 1.35rem + 1.2vw, 2.4rem);
  --step-3:  clamp(2.2rem, 1.7rem + 2.4vw, 3.6rem);
  --step-4:  clamp(3rem, 2.1rem + 4.4vw, 5.4rem);
  --step-5:  clamp(3.8rem, 2.2rem + 7.5vw, 8rem);

  /* Spacing */
  --gutter: clamp(1.25rem, 0.8rem + 2.2vw, 3rem);
  --section: clamp(5rem, 3rem + 9vw, 11rem);
  --maxw: 1440px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io:  cubic-bezier(0.76, 0, 0.24, 1);
  --dur: 0.6s;

  /* Z scale */
  --z-base: 1;
  --z-sticky: 100;
  --z-nav: 200;
  --z-overlay: 300;
  --z-cursor: 9999;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul { list-style: none; }
::selection { background: var(--red); color: var(--paper); }

/* Grain overlay — fixed, non-interactive */
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  opacity: 0.035;
  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='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Typography ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.02; letter-spacing: -0.025em; text-wrap: balance; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); letter-spacing: -0.02em; }
p  { text-wrap: pretty; }

.mono {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  font-weight: 500;
}
.kicker {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--red);
  font-weight: 500;
}
.lede { font-size: var(--step-1); line-height: 1.4; color: var(--ink-2); max-width: 34ch; }

/* Outline / stroke display text */
.stroke {
  color: transparent;
  -webkit-text-stroke: 1.4px var(--line-strong);
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section); }
.divider { border: none; border-top: 1px solid var(--line); }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--ink); --fg: var(--paper);
  display: inline-flex; align-items: center; gap: 0.7em;
  background: var(--bg); color: var(--fg);
  padding: 0.9em 1.4em;
  font-weight: 700; font-size: var(--step-0);
  letter-spacing: -0.01em;
  border-radius: 0;
  position: relative; overflow: hidden;
  transition: transform 0.5s var(--ease-out);
  will-change: transform;
}
.btn > * { position: relative; z-index: 1; }
.btn::before {
  content: ""; position: absolute; inset: 0;
  background: var(--red);
  transform: translateY(101%);
  transition: transform 0.5s var(--ease-out);
}
.btn:hover::before { transform: translateY(0); }
.btn:active { transform: scale(0.98); }
.btn .arrow {
  display: grid; place-items: center;
  width: 1.6em; height: 1.6em; border-radius: 999px;
  background: color-mix(in oklch, var(--fg) 15%, transparent);
  transition: transform 0.5s var(--ease-out);
}
.btn:hover .arrow { transform: translate(3px, -3px); }
.btn--red { --bg: var(--red); --fg: var(--paper); }
.btn--red::before { background: var(--ink); }
.btn--ghost {
  --bg: transparent; --fg: var(--ink);
  border: 1.5px solid var(--line-strong);
}
.btn--ghost::before { background: var(--ink); }
.btn--ghost:hover { color: var(--paper); }
.btn--light { --bg: var(--paper); --fg: var(--ink); }
.btn--light::before { background: var(--red); }
.btn--light:hover { color: var(--paper); }
/* Ghost on dark surfaces (night bands, red CTA blocks): paper text, paper fill on hover */
.btn--ghost-dark { --fg: var(--paper); border-color: oklch(1 0 0 / 0.5); }
.btn--ghost-dark::before { background: var(--paper); }
.btn--ghost-dark:hover { color: var(--ink); }

/* ---------- Custom cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: var(--z-cursor);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
.cursor-dot { width: 7px; height: 7px; background: #fff; }
.cursor-ring {
  width: 40px; height: 40px; border: 1.5px solid #fff;
  transition: background 0.3s var(--ease-out);
}
/* scale handled via GSAP (transform) to stay off the layout path */
.cursor-ring.is-active { background: rgba(255,255,255,0.1); }
.cursor-ring.is-hidden, .cursor-dot.is-hidden { opacity: 0; }
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: var(--z-nav);
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(0.8rem, 0.5rem + 1vw, 1.3rem) var(--gutter);
  mix-blend-mode: normal;
  transition: transform 0.5s var(--ease-out), background 0.4s, backdrop-filter 0.4s, border-color 0.4s, color 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in oklch, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-100%); }
.nav.on-dark { color: var(--on-night); }
.brand {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--step-1); letter-spacing: -0.03em;
  line-height: 1; display: flex; align-items: center; gap: 0.5em;
}
.brand .mark {
  width: 0.62em; height: 0.62em; background: var(--red);
  transform: rotate(45deg); display: inline-block;
}
.nav-links { display: flex; align-items: center; gap: clamp(1.2rem, 0.5rem + 1.6vw, 2.6rem); }
.nav-links a { font-weight: 500; font-size: var(--step-0); position: relative; padding-block: 0.3em; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1.5px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease-out);
}
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
.nav-links a[aria-current="page"] { color: var(--red); }
.nav-cta { display: inline-flex; }
.nav-toggle { display: none; }

/* Mobile nav */
@media (max-width: 860px) {
  .nav-links, .nav-cta { display: none; }
  .nav-toggle {
    display: flex; flex-direction: column; gap: 6px;
    width: 44px; height: 44px; align-items: center; justify-content: center;
    z-index: calc(var(--z-overlay) + 1); position: relative;
  }
  .nav-toggle span { width: 26px; height: 2px; background: currentColor; transition: transform 0.4s var(--ease-out), opacity 0.3s; }
  body.menu-open .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  body.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
  body.menu-open .nav-toggle, body.menu-open .nav { color: var(--on-night); }
}

/* Fullscreen mobile overlay */
.menu {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: var(--night); color: var(--on-night);
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--gutter);
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.7s var(--ease-io);
  pointer-events: none;
}
body.menu-open .menu { clip-path: inset(0 0 0% 0); pointer-events: auto; }
.menu-links { display: flex; flex-direction: column; gap: 0.1em; }
.menu-links a {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.4rem, 10vw, 4.5rem); line-height: 1.05;
  letter-spacing: -0.03em;
  opacity: 0; transform: translateY(40px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out), color 0.3s;
}
body.menu-open .menu-links a { opacity: 1; transform: translateY(0); }
.menu-links a:nth-child(1) { transition-delay: 0.12s; }
.menu-links a:nth-child(2) { transition-delay: 0.18s; }
.menu-links a:nth-child(3) { transition-delay: 0.24s; }
.menu-links a:nth-child(4) { transition-delay: 0.30s; }
.menu-links a:nth-child(5) { transition-delay: 0.36s; }
.menu-links a:hover { color: var(--red); }
.menu-foot {
  margin-top: clamp(2rem, 5vw, 4rem); display: flex; flex-wrap: wrap; gap: 1.5rem 3rem;
  color: var(--on-night-soft); font-size: var(--step--1);
  opacity: 0; transition: opacity 0.5s 0.4s var(--ease-out);
}
body.menu-open .menu-foot { opacity: 1; }
.menu-foot a { color: var(--on-night); }

/* ---------- Reveal primitives ---------- */
[data-reveal] { opacity: 0; }
[data-reveal="up"] { transform: translateY(38px); }
.reveal-line { display: block; overflow: hidden; }
.reveal-line > span { display: block; will-change: transform; }

/* ---------- Marquee ---------- */
.marquee {
  display: flex; overflow: hidden; white-space: nowrap;
  border-block: 1px solid var(--line);
  padding-block: clamp(1rem, 2vw, 1.8rem);
  gap: 0;
  user-select: none;
}
.marquee__track {
  display: flex; flex-shrink: 0; align-items: center; gap: 2.5rem;
  padding-right: 2.5rem;
  animation: marquee 32s linear infinite;
  will-change: transform;
}
.marquee.is-red { background: var(--red); color: var(--paper); border-color: transparent; }
.marquee__item {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 3rem); letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: 2.5rem;
}
.marquee__item .dot { width: 0.4em; height: 0.4em; background: currentColor; transform: rotate(45deg); }
@keyframes marquee { to { transform: translateX(-100%); } }

/* ---------- Credential / stat row ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}
.stat {
  padding: clamp(1.5rem, 3vw, 2.6rem) 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding-inline: clamp(1rem, 2vw, 1.8rem);
}
.stat:nth-child(4n) { border-right: none; }
.stat__num {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--step-3); line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat__label { margin-top: 0.6rem; color: var(--ink-soft); font-size: var(--step--1); }
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(4n) { border-right: 1px solid var(--line); }
  .stat:nth-child(2n) { border-right: none; }
}

/* ---------- Footer ---------- */
.footer {
  background: var(--night); color: var(--on-night);
  padding-block: clamp(3.5rem, 6vw, 6rem) 2.5rem;
}
.footer a { transition: color 0.3s; }
.footer a:hover { color: var(--red); }
.footer__top {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
  border-bottom: 1px solid oklch(1 0 0 / 0.12);
}
.footer__big {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--step-3); line-height: 1; letter-spacing: -0.03em;
}
.footer__col h4 { font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.15em; color: var(--on-night-soft); font-family: var(--font-mono); font-weight: 500; margin-bottom: 1.2rem; }
.footer__col ul { display: flex; flex-direction: column; gap: 0.7rem; }
.footer__col a, .footer__col p { color: var(--on-night); font-size: var(--step-0); }
.footer__bottom {
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between;
  padding-top: 2rem; color: var(--on-night-soft); font-size: var(--step--1);
  font-family: var(--font-mono);
}
@media (max-width: 820px) {
  .footer__top { grid-template-columns: 1fr 1fr; }
  .footer__big { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .footer__top { grid-template-columns: 1fr; }
}

/* ---------- Utility ---------- */
.eyebrow-row { display: flex; align-items: center; gap: 1rem; margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.eyebrow-row .kicker { white-space: nowrap; }
.eyebrow-row .rule { flex: 1; height: 1px; background: var(--line); }
.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;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: calc(var(--z-cursor) + 1);
  background: var(--ink); color: var(--paper); padding: 0.8em 1.2em;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .marquee__track { animation: none; }
  .cursor-dot, .cursor-ring { display: none; }
}
