/* ==========================================================================
   Data Driven Solutions, datadrivensolutions.rs
   Hand-coded. Paper + ink + one cobalt. Cabinet Grotesk / Satoshi / Geist Mono.
   ========================================================================== */

/* ---------- Fonts (self-hosted, subset woff2) ---------- */
@font-face { font-family: "Cabinet Grotesk"; src: url("../fonts/CabinetGrotesk-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Cabinet Grotesk"; src: url("../fonts/CabinetGrotesk-Bold.woff2")   format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Satoshi";         src: url("../fonts/Satoshi-Regular.woff2")       format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Satoshi";         src: url("../fonts/Satoshi-Medium.woff2")        format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono";      src: url("../fonts/GeistMono-Regular.woff2")     format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --paper:    #ebeae5;
  --paper-2:  #e0dfd9;
  --ink:      #111214;
  --ink-2:    #5b5e69;
  --ink-3:    #8f919b;
  --rule:     rgba(17, 18, 20, 0.16);
  --accent:   #1d2ce0;
  --accent-dark: #7b87ff;

  --bg: var(--paper);
  --fg: var(--ink);

  --display: "Cabinet Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --text:    "Satoshi", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono:    "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(20px, 4.2vw, 76px);
  --gap:    clamp(16px, 2vw, 32px);
  --nav-h:  64px;
  --section: clamp(96px, 14vh, 184px);

  --ease: cubic-bezier(0.22, 0.74, 0.18, 1);
  color-scheme: light;
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.reduce { scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--accent); color: var(--paper); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.label .count { text-transform: none; letter-spacing: 0.01em; color: var(--ink-2); }
.amp { color: var(--accent); }
.soft { color: var(--ink-2); }
.arrow { display: inline-block; margin-left: 0.5em; transition: transform 0.5s var(--ease); }
a:hover .arrow { transform: translateX(4px); }
a:hover .arrow:is([aria-hidden]):where(.up) { transform: translateY(-3px); }

/* ---------- Layout primitives ---------- */
.wrap { padding-inline: var(--gutter); max-width: 1680px; margin-inline: auto; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }

.section-head {
  position: relative;
  padding-top: 14px;
  margin-bottom: clamp(40px, 7vh, 96px);
}
.rule {
  display: block;
  height: 1px;
  background: var(--rule);
  transform-origin: left center;
}
.section-head .rule { position: absolute; inset: 0 0 auto 0; }

/* Text masks for directed reveals */
.mask { display: block; overflow: clip; }
.mask .in { display: block; }

/* ---------- Grain ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 260px 260px;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 80;
  height: var(--nav-h);
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--ink);
  background: var(--paper);            /* always opaque: content can never show through the bar */
  transform: translateY(0);
  transition: transform 0.55s var(--ease);
}
/* Hairline under the bar once it has a background */
.nav::after {
  content: "";
  position: absolute;
  left: var(--gutter); right: var(--gutter); bottom: 0;
  height: 1px;
  background: var(--rule);
  opacity: 0;
  transition: opacity 0.25s linear;
}
.nav.is-scrolled::after { opacity: 1; }
.nav.is-hidden { transform: translateY(-100%); }
/* Over the ink section, and while the mobile menu is open: same bar, inverted */
.nav.is-dark, .nav.is-menu {
  background: var(--ink);
  color: var(--paper);
  --rule: rgba(235, 234, 229, 0.16);
  --accent: var(--accent-dark);
}
.nav.is-menu { transform: translateY(0); }
.wordmark {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
}
.mark {
  width: 8px; height: 8px;
  background: var(--accent);
  transition: transform 0.6s var(--ease);
}
.wordmark:hover .mark { transform: rotate(90deg); }
.nav-meta { justify-self: center; opacity: 0.8; }
.nav-links { justify-self: end; display: flex; gap: clamp(20px, 2.4vw, 40px); }
.nav-links a,
.email,
.footer-links a,
.step-link,
.hero-index a {
  position: relative;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 0% 1px;
  background-position: left calc(100% - 1px);
  transition: background-size 0.6s var(--ease), color 0.35s var(--ease);
}
.nav-links a:hover, .nav-links a:focus-visible,
.email:hover, .email:focus-visible,
.footer-links a:hover,
.step-link:hover,
.hero-index a:hover { background-size: 100% 1px; color: var(--accent); }
.nav-links a { font-size: 0.875rem; font-weight: 500; letter-spacing: -0.005em; padding-bottom: 2px; }
.menu-btn { display: none; justify-self: end; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.6875rem; padding: 8px 0; }

/* Mobile menu overlay */
.menu {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--ink);
  color: var(--paper);
  visibility: hidden; /* parked off-screen by JS (yPercent -100); .open makes it visible */
  padding: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 24px) var(--gutter) calc(32px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.menu.open { visibility: visible; }
.menu-links { display: flex; flex-direction: column; }
.menu-links a {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 9vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  padding: 18px 0;
  border-bottom: 1px solid rgba(235, 234, 229, 0.16);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.menu-index { color: var(--accent-dark); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.6875rem; }
.menu-foot { color: var(--ink-3); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + clamp(24px, 5vh, 56px));
  padding-bottom: clamp(24px, 4vh, 48px);
}
.eyebrow { grid-column: 1 / 6; }
.hero-geo { grid-column: 9 / 13; text-align: right; color: var(--ink-2); }
.hero-main { align-self: center; padding-block: clamp(40px, 8vh, 96px); }
.hero-title {
  grid-column: 1 / 12;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.5rem, 6.6vw, 7rem);
  line-height: 0.98;
  letter-spacing: -0.028em;
  text-wrap: balance;
  max-width: 14ch;
}
/* Entrance choreography: these start hidden and are composed in by JS; the fallback class
   (added by JS after 3.5 s) guarantees nothing can stay hidden if the sequence never runs. */
.js:not(.reduce) .hero-title { visibility: hidden; }
.js:not(.reduce) [data-intro] { visibility: hidden; }
.intro-fallback .hero-title, .intro-fallback [data-intro], .intro-fallback .philosophy-text { visibility: visible !important; }
.hero-title .line-mask { padding-block: 0.08em; margin-block: -0.08em; } /* room for ascenders/descenders inside the clip */
.hero-title .amp { display: inline-block; }
.hero-bottom { align-items: end; }
.scroll-cue {
  grid-column: 1 / 4;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-2);
}
.scroll-line { display: block; width: 1px; height: 40px; background: var(--ink); transform-origin: top; }
.hero-index {
  grid-column: 8 / 13;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px var(--gap);
  color: var(--ink-2);
}
.hero-index li::before { content: "· "; color: var(--ink-3); }

/* ---------- Position / manifesto ---------- */
.manifesto { padding-block: var(--section); }
.manifesto-text {
  grid-column: 3 / 12;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.5rem, 3.1vw, 3.1rem);
  line-height: 1.16;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}
.manifesto-text .w { will-change: opacity; }

/* ---------- Capabilities ---------- */
.caps { padding-block: 0 var(--section); }
.cap {
  position: relative;
  padding-block: clamp(28px, 4vh, 48px);
  row-gap: 18px;
  align-items: start;
}
.cap-rule, .stat-rule {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--rule);
  transform-origin: left center;
}
.cap-end { position: relative; height: 1px; }
.cap-tag { grid-column: 1 / 3; color: var(--ink-2); padding-top: 0.55em; transition: color 0.4s var(--ease); }
.cap-title {
  grid-column: 3 / 9;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.625rem, 2.9vw, 2.9rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
  transition: transform 0.7s var(--ease);
  text-wrap: balance;
}
.cap-desc {
  grid-column: 3 / 9;
  max-width: 44ch;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}
.cap-items {
  grid-column: 9 / 13;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9375rem;
  color: var(--ink-2);
  padding-top: 0.35em;
}
.cap-items li { display: flex; gap: 12px; }
.cap-items li::before { content: ""; width: 5px; height: 5px; margin-top: 0.55em; background: var(--paper-2); flex: none; transition: background 0.4s var(--ease); }
@media (hover: hover) {
  .cap:hover .cap-title { transform: translateX(10px); }
  .cap:hover .cap-tag { color: var(--accent); }
  .cap:hover .cap-items li::before { background: var(--accent); }
}

/* ---------- Approach ---------- */
.approach { position: relative; }
.approach-pin {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding-top: calc(var(--nav-h) + clamp(16px, 4vh, 40px));
  padding-bottom: clamp(24px, 4vh, 40px);
}
.approach-pin > .wrap:first-child { width: 100%; }
.approach-pin .section-head { margin-bottom: clamp(24px, 5vh, 64px); }
.approach-track {
  flex: 1;
  display: flex;
  align-items: center;
  padding-inline: var(--gutter);
  gap: clamp(32px, 6vw, 120px);
  will-change: transform;
}
.step {
  flex: none;
  width: clamp(280px, 58vw, 900px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}
.step-when { color: var(--accent); }
.step-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(3.25rem, 9.5vw, 11rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin-top: 8px;
}
.step-text {
  font-size: clamp(1.0625rem, 1.35vw, 1.3125rem);
  line-height: 1.45;
  max-width: 46ch;
  color: var(--ink-2);
  margin-top: 8px;
}
.step-link { align-self: flex-start; font-weight: 500; font-size: 0.9375rem; margin-top: 8px; padding-bottom: 2px; }
.approach-foot {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: clamp(28px, 5vh, 56px);
  color: var(--ink-2);
}
.approach-progress { flex: 1; height: 1px; background: var(--rule); position: relative; }
.approach-progress i { position: absolute; inset: 0; background: var(--accent); transform: scaleX(0); transform-origin: left; }

/* ---------- Philosophy ---------- */
.philosophy { padding-block: 0 var(--section); }
.philosophy .grid { row-gap: clamp(32px, 6vh, 64px); }
.philosophy-text {
  grid-column: 2 / 12;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 4.9vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
  padding-block: clamp(24px, 6vh, 72px) 0;
}
.js:not(.reduce) .philosophy-text { visibility: hidden; }
.philosophy-note { grid-column: 2 / 6; color: var(--ink-2); }

/* ---------- Proof (ink) ---------- */
.is-ink {
  --bg: var(--ink);
  --fg: var(--paper);
  --ink-2: #a3a5ae;
  --ink-3: #6c6f79;
  --rule: rgba(235, 234, 229, 0.16);
  --accent: var(--accent-dark);
  --paper-2: #2a2c31;
  background: var(--bg);
  color: var(--fg);
}
.proof { padding-block: clamp(72px, 10vh, 128px) var(--section); }
.stats { row-gap: clamp(56px, 10vh, 140px); }
.stat { position: relative; padding-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.stat-a { grid-column: 1 / 7; }
.stat-b { grid-column: 7 / 13; margin-top: clamp(64px, 16vh, 220px); }
.stat-c { grid-column: 3 / 10; }
.stat-tag { color: var(--accent); }
.stat-from { color: var(--ink-3); margin-top: -6px; }
.stat-num {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(4rem, 10.5vw, 11rem);
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
}
.stat-num .sign { font-weight: 500; color: var(--ink-2); margin-right: 0.04em; }
.stat-num .unit { font-weight: 500; font-size: 0.5em; color: var(--ink-2); margin-left: 0.06em; }
.stat-ctx { font-size: clamp(1rem, 1.2vw, 1.1875rem); color: var(--ink-2); max-width: 32ch; line-height: 1.45; text-wrap: pretty; }

/* ---------- Contact ---------- */
.contact { padding-block: var(--section) clamp(72px, 10vh, 128px); }
.contact-grid { row-gap: clamp(40px, 6vh, 72px); }
.contact-title {
  grid-column: 1 / 8;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.25rem, 5.4vw, 5.75rem);
  line-height: 0.98;
  letter-spacing: -0.028em;
}
.contact-main {
  grid-column: 1 / 9;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px 28px;
}
.email {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.375rem, 3.4vw, 3.5rem);
  letter-spacing: -0.025em;
  line-height: 1.1;
  padding-bottom: 4px;
  background-position: left calc(100% - 2px);
  overflow-wrap: anywhere;
}
.email:hover { color: var(--accent); }
.copy {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.6875rem;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  padding: 9px 14px;
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease), background 0.4s var(--ease);
}
.copy:hover, .copy.done { color: var(--paper); background: var(--accent); border-color: var(--accent); }
.contact-meta {
  grid-column: 9 / 13;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--ink-2);
  align-self: end;
}
.contact-meta > div { display: grid; grid-template-columns: 12ch 1fr; gap: 12px; }
.contact-meta dt { color: var(--ink-3); }
.contact-meta dd { color: var(--ink); }

/* ---------- Legal documents (privacy.html, terms.html) ---------- */
.doc { padding-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + clamp(40px, 10vh, 112px)); padding-bottom: var(--section); }
.doc-grid { row-gap: clamp(40px, 6vh, 72px); }
.doc-title {
  grid-column: 1 / 8;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.25rem, 5.4vw, 5.75rem);
  line-height: 0.98;
  letter-spacing: -0.028em;
}
.doc-body { grid-column: 4 / 11; max-width: 64ch; font-size: 1.0625rem; line-height: 1.6; }
.doc-body h2 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-2);
  margin: 2.75rem 0 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}
.doc-body h2:first-child { margin-top: 0; }
.doc-body p + p, .doc-body p + ul { margin-top: 0.75rem; }
.doc-body ul { display: flex; flex-direction: column; gap: 6px; }
.doc-body li { display: flex; gap: 12px; }
.doc-body li::before { content: ""; width: 5px; height: 5px; margin-top: 0.7em; background: var(--accent); flex: none; }
.doc-link { text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; transition: color 0.4s var(--ease), text-decoration-color 0.4s var(--ease); }
.doc-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ---------- Footer ---------- */
.footer { padding-block: 22px calc(28px + env(safe-area-inset-bottom, 0px)); position: relative; }
.footer > .rule { position: absolute; top: 0; left: var(--gutter); right: var(--gutter); }
.footer-row { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; color: var(--ink-2); }
.footer-links { display: flex; gap: 28px; }
.footer-links a { padding-bottom: 1px; }
.footer-links a:hover { color: var(--ink); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1199px) {
  .hero-index { grid-column: 9 / 13; grid-template-columns: 1fr; }
}
@media (max-width: 1023px) {
  .nav-meta { display: none; }
  /* Approach: vertical sequence on tablet/phone */
  .approach-pin { min-height: 0; padding-top: 0; padding-bottom: var(--section); }
  .approach-track { flex-direction: column; gap: clamp(48px, 8vh, 80px); padding-inline: var(--gutter); }
  .step { width: 100%; }
  .approach-foot { display: none; }
}

@media (max-width: 767px) {
  :root { --nav-h: 56px; }
  .nav { grid-template-columns: 1fr auto; }
  .nav-links { display: none; }
  .menu-btn { display: inline-block; }

  .hero { min-height: 100svh; }
  .eyebrow { grid-column: 1 / 6; }
  .hero-geo { grid-column: 6 / 13; }
  .hero-title { grid-column: 1 / 13; font-size: clamp(2.375rem, 11.5vw, 4rem); max-width: none; }
  .hero-bottom { row-gap: 28px; }
  .scroll-cue { grid-column: 1 / 13; order: 2; }
  .hero-index { grid-column: 1 / 13; grid-template-columns: 1fr; order: 1; }

  .manifesto-text { grid-column: 1 / 13; font-size: clamp(1.375rem, 6vw, 1.75rem); }

  .cap { row-gap: 12px; }
  .cap-tag { grid-column: 1 / 13; padding-top: 0; }
  .cap-title { grid-column: 1 / 13; }
  .cap-desc { grid-column: 1 / 13; font-size: 0.9375rem; }
  .cap-items { grid-column: 1 / 13; grid-row: auto; padding-top: 6px; }
  .philosophy-text { grid-column: 1 / 13; font-size: clamp(1.75rem, 8vw, 2.5rem); }
  .philosophy-note { grid-column: 1 / 13; }
  .cap:hover .cap-title { transform: none; }

  .stat-a, .stat-b, .stat-c { grid-column: 1 / 13; margin-top: 0; }
  .stats { row-gap: clamp(48px, 8vh, 72px); }

  .contact-title, .contact-main, .contact-meta { grid-column: 1 / 13; }
  .doc-title, .doc-body { grid-column: 1 / 13; }
  .contact-meta > div { grid-template-columns: 12ch 1fr; }
  .footer-row { flex-direction: column; gap: 14px; }
  .footer-links { gap: 20px; flex-wrap: wrap; }
}

/* ---------- Reduced motion: everything at rest ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain { display: none; }
  .scroll-line { display: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
  .approach-progress i { transform: scaleX(1); }
}
