/* ==========================================================
   Midstream Integrations — site styles
   Colors come straight from the logo.
   ========================================================== */

:root {
  --ink: #0E0C1A;          /* favicon background */
  --ink-2: #1A1730;        /* raised surfaces on dark */
  --ink-3: #2A2648;        /* borders on dark */
  --paper: #F6F5FA;        /* cool off-white page */
  --white: #FFFFFF;
  --violet: #A824F8;       /* logo purple */
  --violet-text: #8A12D6;  /* purple dark enough for text on light */
  --cyan: #00F0FF;         /* logo cyan (dark backgrounds) */
  --cyan-deep: #00A9C6;    /* logo cyan on light backgrounds */
  --text: #1C1A2B;
  --muted: #5B5872;
  --muted-on-dark: #B4B0CC;
  --line: #E3E1EC;

  --font-head: "Montserrat", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius-sm: 6px;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

img, svg { max-width: 100%; display: block; }

a { color: var(--violet-text); text-underline-offset: 3px; }
a:hover { color: var(--violet); }

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

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--white); color: var(--ink);
  padding: 10px 14px; border-radius: var(--radius-sm);
  z-index: 100; font-weight: 600;
}
.skip-link:focus { top: 12px; }

.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- Type scale (1.25 ratio) ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  color: inherit;
}
h1 { font-size: clamp(2.2rem, 5.2vw, 3.8rem); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; }
h3 { font-size: 1.3rem; font-weight: 700; }
h4 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: 68ch; }
.lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.55; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font-family: var(--font-head); font-weight: 700; font-size: 1rem;
  padding: 0.9em 1.4em; border-radius: 999px;
  text-decoration: none; border: 2px solid transparent;
  transition: background-color .15s, color .15s, border-color .15s;
  cursor: pointer;
}
.btn-primary { background: var(--violet); color: var(--white); }
.btn-primary:hover { background: #9310E6; color: var(--white); }
.btn-ghost { border-color: currentColor; color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }
.on-dark .btn-ghost { color: var(--white); }
.on-dark .btn-ghost:hover { background: var(--white); color: var(--ink); border-color: var(--white); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--ink);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--ink-3);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 72px; gap: 24px;
}
.brand img { height: 38px; width: auto; }
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--ink-3); color: var(--white);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font: 600 0.95rem var(--font-body); cursor: pointer;
}
.nav-list { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.nav-list a {
  display: block; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--muted-on-dark); text-decoration: none; font-weight: 500;
}
.nav-list a:hover { color: var(--white); }
.nav-list a[aria-current="page"] { color: var(--white); box-shadow: inset 0 -2px 0 var(--cyan); border-radius: 0; }
.nav-list .nav-cta { margin-left: 8px; background: var(--violet); color: var(--white); border-radius: 999px; padding: 8px 16px; font-weight: 600; }
.nav-list .nav-cta:hover { background: #9310E6; }

@media (max-width: 900px) {
  .brand img { height: 30px; }
  .nav-toggle { display: inline-block; }
  .site-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--ink); border-bottom: 1px solid var(--ink-3); display: none; }
  .site-nav.open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; padding: 8px var(--gutter) 20px; }
  .nav-list a { padding: 12px 4px; }
  .nav-list a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--cyan); padding-left: 14px; }
  .nav-list .nav-cta { margin: 10px 0 0; text-align: center; padding: 12px; }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(64px, 9vw, 112px); }
.section-tight { padding-block: clamp(48px, 6vw, 72px); }
.on-dark { background: var(--ink); color: var(--white); }
.on-dark .lead, .on-dark p { color: var(--muted-on-dark); }
.on-dark a:not(.btn) { color: var(--cyan); }
.on-white { background: var(--white); }
.section-head { max-width: 760px; margin-bottom: clamp(32px, 5vw, 56px); }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(56px, 8vw, 104px) clamp(56px, 7vw, 88px); overflow: hidden; }
.hero h1 { max-width: 15ch; color: var(--white); }
.hero .lead { max-width: 60ch; }

/* Signature element: the pipeline from the logo, drawn large. */
.pipeline {
  margin-top: clamp(48px, 7vw, 80px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(40px, 1.1fr) auto minmax(40px, 1.1fr) minmax(0, 1fr);
  align-items: center;
}
.pipe-node {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.pipe-node strong { display: block; font-family: var(--font-head); font-size: 1.05rem; color: var(--white); }
.pipe-node span { display: block; font-size: 0.92rem; color: var(--muted-on-dark); margin-top: 2px; }
.pipe-node.bc { border-left: 4px solid var(--violet); }
.pipe-node.yours { border-right: 4px solid var(--cyan); text-align: right; }
.pipe-hub {
  width: 112px; height: 112px; border-radius: 28px;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  display: grid; place-items: center;
}
.pipe-hub img { width: 76px; height: 76px; }
.pipe-line { position: relative; height: 40px; }
.pipe-line::before, .pipe-line::after {
  content: ""; position: absolute; left: 0; right: 0; height: 4px; border-radius: 4px;
}
.pipe-line::before { top: 10px; background: linear-gradient(90deg, var(--violet), #6A4BF6); }
.pipe-line::after  { bottom: 10px; background: linear-gradient(90deg, #3B7BF2, var(--cyan)); }
.pipe-line.right::before { background: linear-gradient(90deg, #6A4BF6, #3B7BF2); }
.pipe-line.right::after  { background: linear-gradient(90deg, #3B7BF2, var(--cyan)); }

.packet {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  margin-top: -4px; margin-left: -6px;
}
.packet.out { top: 12px; background: var(--violet); box-shadow: 0 0 12px var(--violet); animation: flow-right 2.6s linear infinite; }
.packet.back { bottom: 8px; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); animation: flow-left 2.6s linear infinite; }
.packet.d1 { animation-delay: -1.3s; }
.right .packet.out { background: #6A4BF6; box-shadow: 0 0 12px #6A4BF6; }

@keyframes flow-right { from { left: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } to { left: 100%; opacity: 0; } }
@keyframes flow-left  { from { left: 100%; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } to { left: 0; opacity: 0; } }

.pipeline-caption { margin-top: 18px; font-size: 0.92rem; color: var(--muted-on-dark); text-align: center; max-width: none; }

@media (max-width: 760px) {
  .pipeline { grid-template-columns: 1fr; justify-items: center; }
  .pipe-node { width: 100%; text-align: left; }
  .pipe-node.yours { text-align: left; border-right: 1px solid var(--ink-3); border-left: 4px solid var(--cyan); }
  .pipe-hub { width: 88px; height: 88px; border-radius: 22px; }
  .pipe-hub img { width: 60px; height: 60px; }
  .pipe-line { height: 44px; width: 40px; }
  .pipe-line::before, .pipe-line::after { top: 0; bottom: 0; width: 4px; height: auto; right: auto; }
  .pipe-line::before { left: 10px; background: linear-gradient(180deg, var(--violet), #6A4BF6); }
  .pipe-line::after { left: auto; right: 10px; background: linear-gradient(180deg, #3B7BF2, var(--cyan)); }
  .packet.out { top: 0; left: 12px; margin: -6px 0 0 -4px; animation-name: flow-down; }
  .packet.back { bottom: auto; top: 0; left: auto; right: 8px; margin: -6px 0 0 0; animation-name: flow-up; }
}
@keyframes flow-down { from { top: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { top: 100%; opacity: 0; } }
@keyframes flow-up   { from { top: 100%; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { top: 0; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .packet { display: none; }
}

/* ---------- Page hero (inner pages) ---------- */
.page-hero { padding-block: clamp(56px, 8vw, 96px) clamp(48px, 6vw, 72px); }
.page-hero h1 { color: var(--white); max-width: 20ch; }
.page-hero .lead { max-width: 62ch; }
.badge {
  display: inline-block; font-family: var(--font-head); font-weight: 700; font-size: 0.85rem;
  padding: 4px 12px; border-radius: 999px; margin-bottom: 18px;
  background: rgba(0, 240, 255, 0.12); color: var(--cyan); border: 1px solid rgba(0, 240, 255, 0.35);
}

/* ---------- Pain list ---------- */
.pains { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 2px solid var(--ink); }
.pain { padding: 28px 28px 8px 0; }
.pain + .pain { padding-left: 28px; border-left: 1px solid var(--line); }
.pain h3 { font-size: 1.15rem; }
.pain p { color: var(--muted); font-size: 1rem; }
@media (max-width: 820px) {
  .pains { grid-template-columns: 1fr; }
  .pain, .pain + .pain { padding: 24px 0 4px; border-left: 0; }
  .pain + .pain { border-top: 1px solid var(--line); }
}

/* ---------- Offering rows ---------- */
.offer {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(28px, 5vw, 64px); align-items: center;
  padding-block: clamp(40px, 6vw, 64px);
}
.offer + .offer { border-top: 1px solid var(--line); }
.offer:nth-child(even) .offer-copy { order: 2; }
.offer-copy h3 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); font-weight: 800; }
.offer-copy ul { padding-left: 1.1em; margin: 0 0 1.2em; color: var(--muted); }
.offer-copy li { margin-bottom: 6px; }
.offer-copy li::marker { color: var(--violet); }
.offer-kind { font-weight: 600; color: var(--violet-text); margin-bottom: 8px; }
@media (max-width: 860px) {
  .offer { grid-template-columns: 1fr; }
  .offer:nth-child(even) .offer-copy { order: 0; }
}

/* Code windows: real code, shown because the code is open source */
.code-window {
  background: var(--ink); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--ink-3);
  box-shadow: 0 24px 48px -24px rgba(14, 12, 26, 0.55);
}
.code-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--ink-2); border-bottom: 1px solid var(--ink-3);
  color: var(--muted-on-dark); font-size: 0.85rem;
}
.code-bar .dots { display: flex; gap: 6px; }
.code-bar .dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.code-bar .dots i:nth-child(1) { background: var(--violet); }
.code-bar .dots i:nth-child(2) { background: #3B7BF2; }
.code-bar .dots i:nth-child(3) { background: var(--cyan); }
.code-window pre {
  margin: 0; padding: 20px; overflow-x: auto;
  font: 0.85rem/1.65 var(--font-code); color: #E7E5F4;
}
.tok-k { color: #D08CFF; }   /* keyword */
.tok-s { color: #7FF6FF; }   /* string */
.tok-c { color: #7D7997; }   /* comment */
.tok-f { color: #9DB7FF; }   /* function / type */

/* Mini network monitor mock (sample data only) */
.monitor { color: #E7E5F4; font-size: 0.9rem; }
.monitor-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--ink-3); }
.monitor-stats div { padding: 14px 16px; }
.monitor-stats div + div { border-left: 1px solid var(--ink-3); }
.monitor-stats b { display: block; font: 800 1.4rem var(--font-head); color: var(--white); }
.monitor-stats span { color: var(--muted-on-dark); font-size: 0.82rem; }
.monitor table { width: 100%; border-collapse: collapse; }
.monitor th, .monitor td { text-align: left; padding: 9px 16px; border-bottom: 1px solid var(--ink-3); white-space: nowrap; }
.monitor th { color: var(--muted-on-dark); font-weight: 500; font-size: 0.8rem; }
.monitor td.mono { font-family: var(--font-code); font-size: 0.82rem; }
.monitor .table-scroll { overflow-x: auto; }
.dir { display: inline-flex; align-items: center; gap: 6px; }
.dir::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.dir.in::before { background: var(--cyan); }
.dir.out::before { background: var(--violet); }
.flag { color: #FFB84D; font-weight: 600; }

/* ---------- Steps (a real sequence) ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 40px); counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-top: 64px; }
.steps li::before {
  content: counter(step);
  position: absolute; top: 0; left: 0;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font: 800 1.1rem var(--font-head);
  color: var(--white); background: var(--violet);
}
.steps li:nth-child(2)::before { background: #3B7BF2; }
.steps li:nth-child(3)::before { background: var(--cyan-deep); }
.steps li::after {
  content: ""; position: absolute; top: 21px; left: 56px; right: -12px; height: 2px;
  background: var(--line);
}
.steps li:last-child::after { display: none; }
.steps p { color: var(--muted); }
@media (max-width: 820px) {
  .steps { grid-template-columns: 1fr; }
  .steps li { padding: 0 0 0 64px; min-height: 44px; }
  .steps li::after { display: none; }
}

/* ---------- Open source band ---------- */
.repo-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink-3); }
.repo-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center;
  padding: 22px 0; border-bottom: 1px solid var(--ink-3);
}
.repo-list h3 { margin: 0 0 4px; font-family: var(--font-code); font-size: 1.05rem; font-weight: 600; color: var(--white); }
.repo-list p { margin: 0; font-size: 0.98rem; }
.repo-list .lang { font-size: 0.85rem; color: var(--muted-on-dark); white-space: nowrap; }
.lang::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.lang.al::before { background: var(--violet); }
.lang.py::before { background: #3B7BF2; }
.lang.js::before { background: var(--cyan); }
.on-white .repo-list { border-top-color: var(--line); }
.on-white .repo-list li { border-bottom-color: var(--line); }
.on-white .repo-list h3 { color: var(--ink); }
.on-white .repo-list p, .on-white .repo-list .lang { color: var(--muted); }
.repo-list li[id] { scroll-margin-top: 96px; }
.repo-list .repo-needs { margin-top: 6px; font-size: 0.85rem; font-family: var(--font-code); }
.repo-group { margin: 48px 0 12px; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--violet-text); }
.section-head + .repo-group { margin-top: 0; }

.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- Prose / detail blocks ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 40px 56px; }
.detail-grid h3 { padding-top: 16px; border-top: 3px solid var(--violet); }
.detail-grid > div:nth-child(even) h3 { border-top-color: var(--cyan-deep); }
.detail-grid p, .detail-grid li { color: var(--muted); }
.detail-grid ul { padding-left: 1.1em; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }

.faq { max-width: 820px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 20px 40px 20px 0; position: relative;
  font: 700 1.1rem var(--font-head);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 1.6rem; font-weight: 500; color: var(--violet-text);
}
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--muted); padding-bottom: 12px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 18px; max-width: 640px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--text);
  padding: 12px 14px; border: 1.5px solid #CFCCDD; border-radius: var(--radius-sm);
  background: var(--white);
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(168, 36, 248, 0.2); }
.form-note { font-size: 0.92rem; color: var(--muted); }
.form-status { font-weight: 600; min-height: 1.6em; }
.form-status.ok { color: #0A7D5A; }
.form-status.err { color: #B42318; }
.hp { position: absolute; left: -9999px; }

.contact-side h3 { margin-top: 0; }
.contact-side p { color: var(--muted); }
.contact-side .item { padding: 20px 0; border-bottom: 1px solid var(--line); }
.contact-side .item:first-child { padding-top: 0; }

/* ---------- CTA band ---------- */
.cta-band { text-align: left; }
.cta-band .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: center; }
.cta-band h2 { margin-bottom: 8px; color: var(--white); }
.cta-band p { margin: 0; }
@media (max-width: 760px) { .cta-band .wrap { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--muted-on-dark); padding-block: 56px 32px; border-top: 1px solid var(--ink-3); }
.footer-top { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 32px; }
.footer-logo { width: 280px; height: auto; }
.site-footer h4 { color: var(--white); font-size: 0.95rem; margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: var(--muted-on-dark); text-decoration: none; }
.site-footer a:hover { color: var(--white); text-decoration: underline; }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--ink-3); display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: 0.88rem; }
.footer-bottom p { margin: 0; max-width: none; }
@media (max-width: 760px) { .footer-top { grid-template-columns: 1fr 1fr; } .footer-top > :first-child { grid-column: 1 / -1; } .footer-logo { width: 240px; } }

/* ---------- Utilities ---------- */
.mt-0 { margin-top: 0; }
.center { text-align: center; }
.not-found { min-height: 60vh; display: grid; align-content: center; }
.on-dark + .cta-band.on-dark { border-top: 1px solid var(--ink-3); }
