/* digi-agent — visual system
   ----------------------------------------------------------------------
   Type:   Geist (UI), Geist Mono (code/eyebrows), Instrument Serif (accent)
   Light:  warm paper / near-black ink / cobalt signal / live green
   Grain:  subtle SVG noise overlay on body
   ---------------------------------------------------------------------- */

:root {
  --bg:        #F7F6F1;
  --paper:     #FFFFFF;
  --ink:       #0B0B0C;
  --ink-2:     #1A1A1B;
  --muted:     #6A6A6F;
  --muted-2:   #9A9A9E;
  --hair:      #E6E4DC;
  --hair-2:    #ECEAE3;
  --chip:      #F0EEE6;

  --signal:    #2C6BFF;          /* links / interactive emphasis */
  --signal-2:  #2046b8;
  --live:      #1FB57A;          /* live ERP / status */
  --live-soft: #E6F6EE;
  --warn:      #E07A0F;
  --warn-soft: #FAEBD8;

  --accent:    var(--ink);       /* CTA fill — swap via tweaks */
  --accent-fg: #FAFAF7;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-1:  0 1px 0 rgba(11,11,12,0.04), 0 1px 2px rgba(11,11,12,0.04);
  --shadow-2:  0 6px 16px -8px rgba(11,11,12,0.18), 0 1px 0 rgba(11,11,12,0.04);
  --shadow-3:  0 24px 60px -28px rgba(11,11,12,0.28), 0 2px 4px rgba(11,11,12,0.06);

  --max:       1240px;
  --gutter:    24px;
}

[data-theme="dark"] {
  --bg:        #0B0B0C;
  --paper:     #131316;
  --ink:       #F4F2EC;
  --ink-2:     #E6E3DB;
  --muted:     #9A9A9F;
  --muted-2:   #6F6F75;
  --hair:      #25252A;
  --hair-2:    #1B1B1F;
  --chip:      #1A1A1E;
  --live-soft: #11251C;
  --warn-soft: #2A1E10;
  --accent:    #F4F2EC;
  --accent-fg: #0B0B0C;
  --shadow-1:  0 1px 0 rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2:  0 8px 24px -10px rgba(0,0,0,0.6), 0 1px 0 rgba(0,0,0,0.4);
  --shadow-3:  0 28px 60px -28px rgba(0,0,0,0.7), 0 2px 4px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "ss01", "ss03", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  overflow-x: hidden;
}

/* Hebrew typography: Heebo for body/UI, retain Instrument Serif italic for accents (works for both scripts). */
body.rtl {
  font-family: "Heebo", "Geist", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  line-height: 1.6;
}
body.rtl .mono,
body.rtl code,
body.rtl .eyebrow {
  font-family: "Geist Mono", "Heebo", ui-monospace, monospace;
}
body.rtl .h-display em,
body.rtl .h-section em {
  font-family: "Heebo", "Instrument Serif", serif;
  font-style: normal;
  font-weight: 500;
  color: var(--signal);
}
body.rtl .h-display,
body.rtl .h-section { letter-spacing: -0.01em; }

/* Mirror small directional cues in RTL */
body.rtl .btn .arrow { transform: scaleX(-1); }
body.rtl .btn:hover .arrow { transform: scaleX(-1) translateX(3px); }

/* ERP flow-lane SVG: paths are encoded for LTR (sources on left → sinks on right).
   In RTL the grid swaps the two columns, so flip the SVG to keep arrow direction true. */
body.rtl .flow-lane svg { transform: scaleX(-1); }

/* Form inputs follow document direction automatically */
body.rtl input, body.rtl textarea { text-align: start; }

/* Grain overlay — very subtle */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.35; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

/* ---------- typography utilities ---------- */
.eyebrow {
  font-family: "Geist Mono", ui-monospace, "SFMono-Regular", monospace;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--live);
  box-shadow: 0 0 0 3px var(--live-soft);
}
.eyebrow.plain::before { display: none; }

.h-display {
  font-size: clamp(44px, 6.4vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 540;
  margin: 0;
  text-wrap: balance;
}
.h-display em {
  font-family: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.h-section {
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 540;
  margin: 0 0 14px;
  text-wrap: balance;
}
.h-section em {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.015em;
}

.h-sub {
  font-size: 18px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
  max-width: 60ch;
  text-wrap: pretty;
}

.mono {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 12.5px;
  letter-spacing: 0;
}

/* ---------- containers ---------- */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section {
  padding: 88px 0;
  position: relative;
}
@media (max-width: 720px) { section { padding: 64px 0; } }

.section-head {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1.1fr);
  gap: 48px;
  align-items: end;
  margin-bottom: 48px;
}
@media (max-width: 880px) {
  .section-head { grid-template-columns: 1fr; gap: 16px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border-radius: 999px;
  font-size: 15px; font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform .15s ease, background .15s ease, color .15s ease, box-shadow .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: var(--shadow-2);
}
.btn-primary:hover { box-shadow: var(--shadow-3); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--hair);
}
.btn-ghost:hover { background: var(--paper); }
.btn-link {
  height: auto; padding: 0;
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
}
.btn-small { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn .arrow { transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- cards & chrome (used by schematic mocks) ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  background: var(--chip);
  color: var(--ink-2);
  border-radius: 6px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.chip.live { background: var(--live-soft); color: var(--live); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }

.kbd {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  border: 1px solid var(--hair);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--paper);
  font-family: "Geist Mono", monospace;
  font-size: 10.5px;
  color: var(--muted);
}

/* ---------- micro: dotted divider, hairline rules ---------- */
.rule { height: 1px; background: var(--hair); border: 0; margin: 0; }
.rule-dashed {
  height: 1px;
  background-image: linear-gradient(to right, var(--hair) 50%, transparent 50%);
  background-size: 8px 1px;
  background-repeat: repeat-x;
  border: 0;
}

/* ---------- entrance animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .8s cubic-bezier(.2,.7,.2,1) both; }
.fade-up.d1 { animation-delay: .08s; }
.fade-up.d2 { animation-delay: .16s; }
.fade-up.d3 { animation-delay: .24s; }
.fade-up.d4 { animation-delay: .32s; }
.fade-up.d5 { animation-delay: .40s; }

/* Pulse for "live" indicators */
@keyframes pulseDot {
  0%,100% { box-shadow: 0 0 0 0 rgba(31,181,122,0.6); }
  50%     { box-shadow: 0 0 0 6px rgba(31,181,122,0); }
}
.pulse { animation: pulseDot 1.8s ease-in-out infinite; }

/* Marquee for data stream */
@keyframes scrollY {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}
.marquee-y {
  animation: scrollY 30s linear infinite;
}

/* Soft float */
@keyframes floaty {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}
.float { animation: floaty 7s ease-in-out infinite; }

/* ---------- scroll reveal (non-intrusive) ---------- */
.scroll-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
  will-change: opacity, transform;
}
.scroll-reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}
.scroll-reveal.is-in + .scroll-reveal { transition-delay: .05s; }
.scroll-reveal.is-in + .scroll-reveal + .scroll-reveal { transition-delay: .1s; }

/* ---------- pointer glint on cards ---------- */
.card.has-glint {
  position: relative;
}
.card.has-glint::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    220px circle at var(--glint-x, 50%) var(--glint-y, 50%),
    color-mix(in oklab, var(--signal) 10%, transparent),
    transparent 60%
  );
  opacity: 0;
  transition: opacity .3s ease;
}
.card.has-glint:hover::after { opacity: 1; }

/* ---------- scroll-rotated kinetic badge ---------- */
[data-scroll-rotate] {
  transform: rotate(var(--scroll-rot, 0deg));
  transition: transform .2s linear;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
