/* ===========================================================
   MergeLabs — Design System & Site Styles
   =========================================================== */

/* ---------- Tokens ---------- */
:root{
  --bg:#FAFAFA;
  --surface:#FFFFFF;
  --surface-2:#F3F3F4;
  --text:#111111;
  --text-secondary:#5B5B5B;
  --border:#E8E8E8;
  --border-strong:#D8D8D8;

  --purple:#6C4CF5;
  --blue:#4A8CFF;
  --green:#22C55E;

  --purple-tint:#F1EDFE;
  --blue-tint:#EAF2FF;
  --green-tint:#E9FBF0;

  --shadow-sm: 0 1px 2px rgba(17,17,17,0.04), 0 1px 1px rgba(17,17,17,0.03);
  --shadow-md: 0 8px 24px rgba(17,17,17,0.06), 0 2px 8px rgba(17,17,17,0.04);
  --shadow-lg: 0 24px 64px rgba(17,17,17,0.10), 0 8px 24px rgba(17,17,17,0.06);

  --font-display:'Space Grotesk', 'Inter', -apple-system, sans-serif;
  --font-body:'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:'JetBrains Mono', ui-monospace, monospace;

  --container-w: 1240px;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.2s;
  --dur-med: 0.5s;
  --dur-slow: 0.9s;

  --header-h: 84px;

  color-scheme: light;
}

:root[data-theme="dark"]{
  --bg:#0B0B0E;
  --surface:#141417;
  --surface-2:#1B1B20;
  --text:#F5F5F6;
  --text-secondary:#9B9BA3;
  --border:#26262C;
  --border-strong:#34343B;

  --purple-tint:#241C40;
  --blue-tint:#182A45;
  --green-tint:#123322;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.5);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0B0B0E;
    --surface:#141417;
    --surface-2:#1B1B20;
    --text:#F5F5F6;
    --text-secondary:#9B9BA3;
    --border:#26262C;
    --border-strong:#34343B;
    --purple-tint:#241C40;
    --blue-tint:#182A45;
    --green-tint:#123322;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.35);
    --shadow-lg: 0 24px 64px rgba(0,0,0,0.5);
    color-scheme: dark;
  }
}

/* ---------- Reset ---------- */
*,*::before,*::after{ box-sizing:border-box; margin:0; padding:0; }
html{ scroll-behavior:smooth; -webkit-text-size-adjust:100%; }
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  font-size:16px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
  transition:background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
img,svg{ display:block; max-width:100%; }
a{ color:inherit; text-decoration:none; }
ul{ list-style:none; }
button{ font:inherit; color:inherit; background:none; border:none; cursor:pointer; }
input,textarea{ font:inherit; }
::selection{ background:var(--purple); color:#fff; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  *,*::before,*::after{ animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important; scroll-behavior:auto !important; }
}

:focus-visible{ outline:2px solid var(--purple); outline-offset:3px; border-radius:4px; }

.skip-link{
  position:fixed; top:-100px; left:16px; z-index:1000;
  background:var(--text); color:var(--bg);
  padding:12px 20px; border-radius:var(--radius-sm);
  font-weight:600; transition:top var(--dur-fast) var(--ease);
}
.skip-link:focus{ top:16px; }

.container{
  width:100%;
  max-width:var(--container-w);
  margin-inline:auto;
  padding-inline:32px;
}

/* ---------- Typography ---------- */
h1,h2,h3,h4{ font-family:var(--font-display); font-weight:600; letter-spacing:-0.02em; line-height:1.08; }

.eyebrow{
  display:flex; align-items:center; gap:8px;
  font-family:var(--font-mono); font-size:12.5px; letter-spacing:0.12em; text-transform:uppercase;
  color:var(--text-secondary); font-weight:500; margin-bottom:20px;
}
.eyebrow-dot{ width:6px; height:6px; border-radius:50%; background:var(--purple); box-shadow:0 0 0 4px var(--purple-tint); }

.section-title{ font-size:clamp(2rem, 4vw, 3.1rem); margin-bottom:20px; }
.section-sub{ font-size:1.125rem; color:var(--text-secondary); max-width:44ch; }
.section-head{ margin-bottom:64px; }

.grad-text{
  background:linear-gradient(100deg, var(--purple), var(--blue) 55%, var(--green));
  -webkit-background-clip:text; background-clip:text; color:transparent;
}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border-radius:var(--radius-pill);
  font-weight:600; white-space:nowrap;
  transition:transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn-lg{ padding:16px 32px; font-size:1rem; }
.btn-sm{ padding:10px 20px; font-size:0.875rem; }
.btn-block{ width:100%; padding:16px; }

.btn-primary{
  background:var(--text); color:var(--bg);
}
.btn-primary:hover{ transform:translateY(-2px); box-shadow:var(--shadow-md); }
.btn-primary:active{ transform:translateY(0); }

.btn-ghost{
  border:1.5px solid var(--border-strong); color:var(--text); background:transparent;
}
.btn-ghost:hover{ border-color:var(--text); transform:translateY(-2px); }

/* ---------- Header ---------- */
.site-header{
  position:fixed; top:0; left:0; right:0; z-index:500;
  height:var(--header-h);
  display:flex; align-items:center;
  border-bottom:1px solid transparent;
  transition:background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), backdrop-filter var(--dur-fast) var(--ease);
}
.site-header.scrolled{
  background:color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter:blur(14px) saturate(1.4);
  -webkit-backdrop-filter:blur(14px) saturate(1.4);
  border-bottom-color:var(--border);
}
.header-inner{ display:flex; align-items:center; justify-content:space-between; width:100%; }

.brand{ display:flex; align-items:center; gap:0; }
.brand-mark{ flex-shrink:0; margin-right:-1.5px; }
.brand-word{ font-family:var(--font-display); font-weight:600; font-size:1.25rem; letter-spacing:-0.01em; position:relative; top:2px; }

.main-nav ul{ display:flex; gap:40px; }
.main-nav a{
  font-size:0.9375rem; font-weight:500; color:var(--text-secondary);
  position:relative; padding-bottom:4px;
  transition:color var(--dur-fast) var(--ease);
}
.main-nav a::after{
  content:''; position:absolute; left:0; bottom:0; width:0; height:1.5px; background:var(--text);
  transition:width var(--dur-fast) var(--ease);
}
.main-nav a:hover{ color:var(--text); }
.main-nav a:hover::after{ width:100%; }

.header-actions{ display:flex; align-items:center; gap:16px; }

.lang-switch{
  display:flex; align-items:center; gap:2px;
  border:1px solid var(--border); border-radius:var(--radius-pill);
  padding:3px;
}
.lang-btn{
  font-family:var(--font-mono); font-size:11.5px; font-weight:500; letter-spacing:0.04em;
  padding:6px 12px; border-radius:var(--radius-pill); color:var(--text-secondary);
  transition:background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.lang-btn:hover{ color:var(--text); }
.lang-btn.is-active{ background:var(--text); color:var(--bg); }
.lang-switch-mobile{ align-self:flex-start; }

.theme-toggle{
  width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  border:1px solid var(--border); color:var(--text-secondary);
  transition:border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}
.theme-toggle:hover{ color:var(--text); border-color:var(--border-strong); transform:rotate(12deg); }
.icon-moon{ display:none; }
:root[data-theme="dark"] .icon-sun{ display:none; }
:root[data-theme="dark"] .icon-moon{ display:block; }

.nav-toggle{ display:none; width:38px; height:38px; flex-direction:column; align-items:center; justify-content:center; gap:5px; }
.nav-toggle span{ width:20px; height:1.5px; background:var(--text); border-radius:2px; transition:transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease); }
.nav-toggle[aria-expanded="true"] span:nth-child(1){ transform:translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2){ opacity:0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3){ transform:translateY(-6.5px) rotate(-45deg); }

.mobile-nav{
  display:none; position:fixed; inset:var(--header-h) 0 0 0; z-index:400;
  background:var(--bg); padding:32px; flex-direction:column; gap:32px;
  transform:translateY(-12px); opacity:0; pointer-events:none;
  transition:opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  overflow-y:auto;
}
.mobile-nav.open{ opacity:1; transform:translateY(0); pointer-events:auto; }
.mobile-nav ul{ display:flex; flex-direction:column; gap:8px; }
.mobile-nav a{ font-family:var(--font-display); font-size:1.75rem; font-weight:600; padding:12px 0; display:block; }

/* ---------- Reveal on scroll ---------- */
.reveal{ opacity:0; transform:translateY(28px); transition:opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.is-visible{ opacity:1; transform:translateY(0); }

/* ---------- Hero ---------- */
.hero{ position:relative; padding-top:calc(var(--header-h) + 64px); padding-bottom:80px; overflow:hidden; }
.hero-bg{
  position:absolute; inset:0; z-index:-1;
  background:
    radial-gradient(680px 480px at 82% 10%, var(--purple-tint), transparent 60%),
    radial-gradient(520px 420px at 100% 45%, var(--blue-tint), transparent 60%);
  opacity:0.9;
}
.hero-inner{ display:grid; grid-template-columns:1.05fr 0.95fr; align-items:center; gap:40px; min-height:520px; }

.hero-title{ font-size:clamp(2.75rem, 5.6vw, 4.75rem); margin-bottom:28px; }
.hero-sub{ font-size:1.2rem; color:var(--text-secondary); max-width:46ch; margin-bottom:40px; }
.hero-actions{ display:flex; gap:16px; flex-wrap:wrap; }

.hero-visual{ position:relative; width:100%; min-width:0; }
.orbit-stage{ position:relative; width:100%; max-width:560px; aspect-ratio:1/1; margin-inline:auto; container-type:inline-size; }
.orbit-svg{ position:absolute; inset:0; }
.orbit-ring{ fill:none; stroke:var(--border-strong); stroke-width:1; opacity:0.7; }
.orbit-link{ opacity:0.9; }

.orbit-core{
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
  width:76px; height:76px; border-radius:50%;
  background:var(--surface); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  box-shadow:var(--shadow-lg);
  z-index:3;
}

.orbit-node{
  position:absolute; top:50%; left:50%;
  width:0; height:0;
  animation:orbit var(--orbit-dur) linear infinite;
  animation-delay:var(--orbit-delay);
  animation-fill-mode:forwards;
  z-index:2;
}
.node-purple{ --orbit-r: 39.3cqi; }
.node-blue{ --orbit-r: 28.6cqi; }
.node-green{ --orbit-r: 17.9cqi; }
@supports not (container-type: inline-size){
  .node-purple{ --orbit-r: 220px; }
  .node-blue{ --orbit-r: 160px; }
  .node-green{ --orbit-r: 100px; }
}
@keyframes orbit{
  from{ transform:translate(-50%,-50%) rotate(var(--orbit-angle,0deg)) translateX(var(--orbit-r)) rotate(calc(-1 * var(--orbit-angle,0deg))); }
  to{ transform:translate(-50%,-50%) rotate(calc(var(--orbit-angle,0deg) + 360deg)) translateX(var(--orbit-r)) rotate(calc(-1 * (var(--orbit-angle,0deg) + 360deg))); }
}
.node-dot{
  display:flex; width:14px; height:14px; border-radius:50%;
  box-shadow:0 0 0 6px var(--surface), var(--shadow-sm);
}
.node-purple .node-dot{ background:var(--purple); }
.node-blue .node-dot{ background:var(--blue); }
.node-green .node-dot{ background:var(--green); }

.node-label{
  position:absolute; top:50%; left:22px; transform:translateY(-50%);
  white-space:nowrap; font-family:var(--font-mono); font-size:11.5px; font-weight:500;
  background:var(--surface); border:1px solid var(--border); padding:4px 10px; border-radius:var(--radius-pill);
  box-shadow:var(--shadow-sm);
}

.hero-metrics{
  margin-top:88px;
  display:grid; grid-template-columns:repeat(4,1fr);
  border-top:1px solid var(--border);
  border-left:1px solid var(--border);
}
.metric-card{
  padding:32px 28px; border-right:1px solid var(--border); border-bottom:1px solid var(--border);
  display:flex; flex-direction:column; gap:6px;
}
.metric-value{ font-family:var(--font-display); font-size:clamp(2rem, 3vw, 2.75rem); font-weight:600; letter-spacing:-0.02em; }
.metric-infinity{ font-size:clamp(2.4rem, 3.6vw, 3.2rem); }
.metric-label{ font-size:0.9rem; color:var(--text-secondary); }

/* ---------- Manifesto ---------- */
.manifesto{ padding:140px 0; border-top:1px solid var(--border); }
.manifesto-grid{ display:grid; grid-template-columns:1fr 1fr; gap:80px; }
.manifesto-text{ font-size:1.15rem; color:var(--text-secondary); margin-bottom:36px; max-width:46ch; }

.shared-list{ display:grid; grid-template-columns:1fr 1fr; gap:16px 24px; }
.shared-list li{ display:flex; align-items:center; gap:10px; font-weight:500; font-size:0.98rem; }
.shared-dot{ width:7px; height:7px; border-radius:50%; background:linear-gradient(135deg,var(--purple),var(--blue)); flex-shrink:0; }

/* ---------- Products ---------- */
.products{ padding:140px 0; background:var(--surface-2); border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
.product-cards{ display:grid; grid-template-columns:repeat(3,1fr); gap:24px; }

.product-card{
  position:relative; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg);
  padding:36px 32px; min-height:420px; display:flex; flex-direction:column;
  overflow:hidden;
  transition:transform var(--dur-med) var(--ease), box-shadow var(--dur-med) var(--ease), border-color var(--dur-med) var(--ease);
}
.product-card:hover, .product-card:focus-visible{ transform:translateY(-8px); box-shadow:var(--shadow-lg); }
.product-card::before{
  content:''; position:absolute; inset:0; opacity:0; transition:opacity var(--dur-med) var(--ease); z-index:0;
}
.card-purple::before{ background:radial-gradient(340px 220px at 100% 0%, var(--purple-tint), transparent 70%); }
.card-blue::before{ background:radial-gradient(340px 220px at 100% 0%, var(--blue-tint), transparent 70%); }
.card-green::before{ background:radial-gradient(340px 220px at 100% 0%, var(--green-tint), transparent 70%); }
.product-card:hover::before{ opacity:1; }
.product-card > *{ position:relative; z-index:1; }

.product-card-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:28px; }
.product-badge{
  font-family:var(--font-mono); font-size:11.5px; letter-spacing:0.08em; text-transform:uppercase;
  padding:6px 12px; border-radius:var(--radius-pill); font-weight:500;
}
.card-purple .product-badge{ background:var(--purple-tint); color:var(--purple); }
.card-blue .product-badge{ background:var(--blue-tint); color:var(--blue); }
.card-green .product-badge{ background:var(--green-tint); color:var(--green); }
.card-purple .product-icon{ color:var(--purple); }
.card-blue .product-icon{ color:var(--blue); }
.card-green .product-icon{ color:var(--green); }

.product-name{ font-size:1.5rem; margin-bottom:12px; }
.product-mission{ color:var(--text-secondary); margin-bottom:20px; }
.product-details{ display:flex; flex-direction:column; gap:10px; margin-bottom:auto; }
.product-details li{ font-size:0.9rem; color:var(--text-secondary); padding-left:16px; position:relative; }
.product-details li::before{ content:''; position:absolute; left:0; top:8px; width:5px; height:5px; border-radius:50%; background:var(--purple); }

.product-hover-reveal{
  margin-bottom:auto; padding-top:8px;
  opacity:0; transform:translateY(10px);
  transition:opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease);
}
.product-card:hover .product-hover-reveal, .product-card:focus-visible .product-hover-reveal{ opacity:1; transform:translateY(0); }
.compat-score{ display:block; font-family:var(--font-display); font-size:2.75rem; font-weight:600; color:var(--blue); }
.compat-label{ font-size:0.9rem; color:var(--text-secondary); }
.tag-reveal{ display:flex; flex-wrap:wrap; gap:8px; }
.tag-pill{ font-size:0.8rem; font-weight:500; padding:7px 14px; border-radius:var(--radius-pill); background:var(--green-tint); color:var(--green); }

.product-link{ display:inline-flex; align-items:center; gap:6px; font-weight:600; font-size:0.95rem; margin-top:24px; }
.product-link span{ transition:transform var(--dur-fast) var(--ease); }
.product-card:hover .product-link span{ transform:translateX(4px); }

/* ---------- Infrastructure ---------- */
.infra{ padding:140px 0; }
.infra-flow{ position:relative; display:flex; flex-direction:column; gap:0; max-width:520px; margin-inline:auto; }
.infra-line{ position:absolute; left:19px; top:20px; bottom:20px; width:2px; background:var(--border); }
.infra-line-fill{ position:absolute; top:0; left:0; width:100%; height:0%; background:linear-gradient(180deg,var(--purple),var(--blue),var(--green)); transition:height 1.4s var(--ease); }
.infra-node{
  position:relative; display:flex; align-items:center; gap:20px;
  padding:20px 0; font-family:var(--font-display); font-weight:600; font-size:1.15rem;
}
.infra-index{
  flex-shrink:0; width:40px; height:40px; border-radius:50%; background:var(--surface); border:1.5px solid var(--border-strong);
  display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:0.8rem; font-weight:500; color:var(--text-secondary);
  z-index:1;
}
.infra-final .infra-index{ background:var(--text); color:var(--bg); border-color:var(--text); }
.infra-final{ color:var(--text); }

/* ---------- Why ecosystem ---------- */
.why-eco{ padding:140px 0; background:var(--surface-2); border-top:1px solid var(--border); border-bottom:1px solid var(--border); }
.compare{ display:grid; grid-template-columns:1fr 1fr; gap:24px; }
.compare-col{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:40px; }
.compare-label{ font-weight:600; margin-bottom:28px; font-size:1.05rem; }
.compare-viz{ height:120px; display:flex; align-items:center; justify-content:center; gap:20px; margin-bottom:28px; }
.iso-dot{ width:26px; height:26px; border-radius:50%; opacity:0.85; }
.iso-1{ background:var(--purple); }
.iso-2{ background:var(--blue); }
.iso-3{ background:var(--green); }
.compare-desc{ color:var(--text-secondary); font-size:0.98rem; }
.eco-line{ stroke-width:1.6; opacity:0.6; }
.eco-line-purple{ stroke:var(--purple); }
.eco-line-blue{ stroke:var(--blue); }
.eco-line-green{ stroke:var(--green); }
.eco-dot-purple{ fill:var(--purple); }
.eco-dot-blue{ fill:var(--blue); }
.eco-dot-green{ fill:var(--green); }
.compare-connected{ box-shadow:var(--shadow-md); }

/* ---------- Vision ---------- */
.vision{ padding:140px 0; }
.vision-cards{ display:grid; grid-template-columns:repeat(3,1fr); gap:24px; }
.vision-card{ padding:40px 8px 0 0; border-top:1.5px solid var(--border); }
.vision-num{ display:block; font-family:var(--font-mono); color:var(--text-secondary); font-size:0.875rem; margin-bottom:24px; }
.vision-card h3{ font-size:1.4rem; margin-bottom:14px; }
.vision-card p{ color:var(--text-secondary); }

/* ---------- CTA ---------- */
.cta{ padding:160px 0; text-align:center; }
.cta-inner{ display:flex; flex-direction:column; align-items:center; gap:36px; }
.cta-title{ font-size:clamp(2.25rem, 5vw, 3.6rem); max-width:16ch; }
.cta-email{ color:var(--text-secondary); font-family:var(--font-mono); font-size:0.95rem; }
.cta-email:hover{ color:var(--text); }

/* ---------- Footer ---------- */
.site-footer{ border-top:1px solid var(--border); padding-top:72px; }
.footer-inner{ display:grid; grid-template-columns:1.6fr 1fr 1fr 1fr; gap:40px; padding-bottom:56px; }
.footer-brand p{ color:var(--text-secondary); margin-top:14px; max-width:28ch; font-size:0.95rem; }
.footer-col h4{ font-family:var(--font-mono); font-size:0.8rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--text-secondary); font-weight:500; margin-bottom:18px; }
.footer-col ul{ display:flex; flex-direction:column; gap:12px; }
.footer-col a{ font-size:0.95rem; color:var(--text-secondary); transition:color var(--dur-fast) var(--ease); }
.footer-col a:hover{ color:var(--text); }
.footer-bottom{ border-top:1px solid var(--border); padding:28px 32px; }
.footer-bottom p{ font-size:0.85rem; color:var(--text-secondary); }

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 1080px){
  .hero-inner{ grid-template-columns:1fr; gap:64px; }
  .hero-visual{ order:-1; max-width:420px; margin-inline:auto; }
  .manifesto-grid{ grid-template-columns:1fr; gap:40px; }
  .product-cards{ grid-template-columns:1fr 1fr; }
  .vision-cards{ grid-template-columns:1fr 1fr; }
  .footer-inner{ grid-template-columns:1fr 1fr; row-gap:40px; }
}

@media (max-width: 860px){
  .main-nav{ display:none; }
  .header-actions .btn-sm{ display:none; }
  .header-actions > .lang-switch{ display:none; }
  .nav-toggle{ display:flex; }
  .mobile-nav{ display:flex; }

  .hero{ padding-top:calc(var(--header-h) + 40px); }
  .hero-metrics{ grid-template-columns:1fr 1fr; }
  .compare{ grid-template-columns:1fr; }
  .product-cards{ grid-template-columns:1fr; }
  .vision-cards{ grid-template-columns:1fr; gap:32px; }
  .shared-list{ grid-template-columns:1fr; }
}

@media (max-width: 560px){
  .container{ padding-inline:20px; }
  .hero-actions{ flex-direction:column; align-items:stretch; }
  .hero-actions .btn{ width:100%; }
  .footer-inner{ grid-template-columns:1fr; }
  .manifesto, .products, .infra, .why-eco, .vision, .cta{ padding:88px 0; }
  .compare-col{ padding:28px 24px; }
}
