@import "./tokens/tokens.css";
@import "./fonts/fonts.css";
@import "./_ds_bundle.css";

/* The website's brand line (owner, 2026-11-08): this gradient on every ramp edge, in both themes */
:root {
  --c1: #1fa2ff;
  --c2: #3d5bff;
  --c3: #8a2bf2;
  --c4: #e43fb5;
  --c5: #ff8a1f;
  --mark: linear-gradient(90deg, var(--c1) 0%, var(--c2) 26%, var(--c3) 52%, var(--c4) 76%, var(--c5) 100%);
  --md-gradient-ramp: var(--c1) 0%, var(--c2) 26%, var(--c3) 52%, var(--c4) 76%, var(--c5) 100% !important;
}

/* One-colour dark vendor marks read as light marks on the night surfaces; coloured marks keep their colours */
[data-theme="dark"] img[src$="/vendors/anthropic.svg"],
[data-theme="dark"] img[src$="/vendors/brave.svg"],
[data-theme="dark"] img[src$="/vendors/chatwoot.svg"],
[data-theme="dark"] img[src$="/vendors/cursor.svg"],
[data-theme="dark"] img[src$="/vendors/dropbox.svg"],
[data-theme="dark"] img[src$="/vendors/gitea.svg"],
[data-theme="dark"] img[src$="/vendors/github.svg"],
[data-theme="dark"] img[src$="/vendors/githubcopilot.svg"],
[data-theme="dark"] img[src$="/vendors/googlebigquery.svg"],
[data-theme="dark"] img[src$="/vendors/intercom-color.svg"],
[data-theme="dark"] img[src$="/vendors/linear.svg"],
[data-theme="dark"] img[src$="/vendors/matomo.svg"],
[data-theme="dark"] img[src$="/vendors/mysql.svg"],
[data-theme="dark"] img[src$="/vendors/nextcloud.svg"],
[data-theme="dark"] img[src$="/vendors/notion.svg"],
[data-theme="dark"] img[src$="/vendors/ollama.svg"],
[data-theme="dark"] img[src$="/vendors/openai.svg"],
[data-theme="dark"] img[src$="/vendors/openrouter.svg"],
[data-theme="dark"] img[src$="/vendors/semrush.svg"],
[data-theme="dark"] img[src$="/vendors/sentry.svg"],
[data-theme="dark"] img[src$="/vendors/telegram.svg"],
[data-theme="dark"] img[src$="/vendors/pipedrive-color.svg"],
[data-theme="dark"] img[src$="/vendors/mollie-color.png"],
[data-theme="dark"] img[src$="/vendors/sendcloud-color.svg"],
[data-theme="dark"] img[src$="/vendors/freshdesk-color.png"],
[data-theme="dark"] img[src$="/vendors/sipgate-color.svg"],
[data-theme="dark"] img[src$="/vendors/ubiquiti.svg"] {
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

/* The light theme as finished as the night one (owner, 2026-11-08): a white page, quieter hairlines,
   soft layered shadows, and a light announcement band */
[data-theme="light"] {
  --md-color-bg: #ffffff !important;
  --md-color-surface: #ffffff !important;
  --md-color-surface-alt: #f8f9fc !important;
  --md-color-surface-subtle: #f8f9fc !important;
  --md-color-sunken: #f2f4f8 !important;
  --md-color-raised: #ffffff !important;
  --md-color-border: #1015271a !important;
  --md-color-border-strong: #10152726 !important;
  --md-shadow-sm: 0 1px 2px 0 #1018280a, 0 1px 3px 0 #1018280d !important;
  --md-shadow-md: 0 12px 32px -16px #1018282e, 0 4px 10px -4px #1018280f !important;
  --md-shadow-lg: 0 32px 64px -24px #10182847, 0 12px 28px -12px #1018281a !important;
}
[data-theme="light"] .sc-host[data-sc-name="SiteNav"] > div[role="region"] {
  background: linear-gradient(90deg, #eef4ff, #f4eefe 55%, #fff3ea) !important;
  color: #101527 !important;
  border-bottom: 1px solid #1015271a;
}
[data-theme="light"] .sc-host[data-sc-name="SiteNav"] > div[role="region"] a,
[data-theme="light"] .sc-host[data-sc-name="SiteNav"] > div[role="region"] button { color: #101527 !important; }

/* A short intro beside a long column stays in view while the column scrolls (wide screens only) */
@media (min-width: 900px) {
  .md-stick { position: sticky; top: 112px; align-self: start; }
}

/* Marks on a light disc or tile keep their own colours, also at night */
[data-theme="dark"] .md-keep-colors img,
[data-theme="dark"] img.md-keep-colors {
  filter: none !important;
  opacity: 1 !important;
}

/* Legal pages: contents beside the text on wide screens, one column on phones */
.md-legal { display: grid; gap: 32px; }
@media (min-width: 900px) {
  .md-legal { grid-template-columns: 260px minmax(0, 1fr); gap: 56px; align-items: start; }
}

/* The navigation's host lays out as its children, so the header stays at hand over the whole page:
   it steps aside while reading down and returns on the way up (site.js) */
.sc-host[data-sc-name="SiteNav"] { display: contents; }

/* Home hero: the console as a background in the right half, in perspective, fading into the page */
.md-hero-bg { margin: 0; pointer-events: none; }
.md-hero-bg__frame { position: relative; border: 1px solid var(--md-color-border); border-radius: 20px; overflow: hidden; background: var(--md-color-surface); box-shadow: var(--md-shadow-lg); }
@media (min-width: 1000px) {
  /* The tilted frame reaches past a box of its own size (its lower edge drops by about a fifth of its
     width), so an overlay of that box left a lower strip of the screen unfaded and the hero cut it off
     hard. The figure therefore runs from just above the frame down to the hero's lower edge, with room
     for the frame's tilted left corner, and one mask fades the screen: to the right, by the frame's own
     height and before the hero ends, on any screen size. The frame stays where it was (same position,
     same perspective origin). */
  .md-hero-bg { --md-hero-w: min(1180px, 74vw); position: absolute; z-index: 0; top: 32px; bottom: 0;
    left: calc(max(52%, 660px) - 64px); width: calc(var(--md-hero-w) + 64px); padding: 40px 0 0 64px; box-sizing: border-box;
    perspective: 2200px; perspective-origin: calc(64px + var(--md-hero-w) / 2) calc(60px + var(--md-hero-w) * 0.3125);
    -webkit-mask-image: linear-gradient(90deg, #000 50%, transparent 96%), linear-gradient(180deg, #000 55%, transparent 100%),
      linear-gradient(180deg, #000 calc(40px + var(--md-hero-w) * 0.36), transparent calc(40px + var(--md-hero-w) * 0.66));
    -webkit-mask-composite: source-in, source-in;
    mask-image: linear-gradient(90deg, #000 50%, transparent 96%), linear-gradient(180deg, #000 55%, transparent 100%),
      linear-gradient(180deg, #000 calc(40px + var(--md-hero-w) * 0.36), transparent calc(40px + var(--md-hero-w) * 0.66));
    mask-composite: intersect; }
  .md-hero-bg__frame { transform: rotateY(-18deg) rotateX(7deg) rotateZ(1.5deg); transform-origin: left center; }
}
@media (max-width: 999px) {
  .md-hero { display: flex; flex-direction: column; }
  .md-hero-bg { order: 2; margin: 0 24px 32px; }
}

/* Every page hero with a product screen: the text on the left, the screen as a background in the right
   half, in perspective, fading into the page (wide screens; below 1000 px it follows the text).
   The tilted frame reaches past a box of its own size, and a mask only paints inside its own box, so the
   figure's box is the hero's whole height with room left of the frame and right of it, and the frame is
   centred in it (the frame keeps its place). One mask fades the screen: to the right, to nothing by the
   edge of the browser window when the frame would run past it, and downwards, to nothing before the
   hero ends. Geometry: --hs-w the frame's width, --hs-left where it starts inside the hero, --hs-room
   how far the window's edge lies from there, --hs-fh the frame's height (16:10 screenshot, 37 px of
   title bar). */
main { overflow-x: clip; }
@media (min-width: 1000px) {
  main > section[data-screen-label="Hero"]:has(> .sc-host[data-sc-name="HeroShot"]) {
    display: block !important; position: relative; overflow-x: visible !important; overflow-y: clip !important; min-height: 520px; padding-bottom: 72px !important;
  }
  main > section[data-screen-label="Hero"]:has(> .sc-host[data-sc-name="HeroShot"]) > div:first-child {
    position: relative; z-index: 1; max-width: 600px; padding-top: 32px;
  }
  main > section[data-screen-label="Hero"] {
    --hs-w: min(1100px, 72vw); --hs-pad: 24px;
    --hs-sw: min(100vw, 1280px); --hs-left: max(52%, 640px);
    --hs-room: calc(50vw + var(--hs-sw) / 2 - max(var(--hs-sw) * 0.52, 640px) - 24px);
    --hs-span: min(calc(var(--hs-w) * 0.97), var(--hs-room));
    --hs-fh: calc(var(--hs-w) * 0.625 + 37px);
  }
  main > section[data-screen-label="Hero"] > .sc-host[data-sc-name="HeroShot"] {
    position: absolute; z-index: 0; top: 0; bottom: 0; left: calc(var(--hs-left) - var(--hs-pad));
    width: calc(var(--hs-pad) + var(--hs-w) * 1.08); padding-left: var(--hs-pad); box-sizing: border-box;
    display: flex; align-items: center; pointer-events: none;
  }
  main > section[data-screen-label="Hero"] > .sc-host[data-sc-name="HeroShot"] figure { width: var(--hs-w) !important; flex: none; perspective: 2200px !important; }
  main > section[data-screen-label="Hero"] > .sc-host[data-sc-name="HeroShot"] figure > div:first-of-type {
    transform: rotateY(-18deg) rotateX(7deg) rotateZ(1.5deg) !important; transform-origin: left center !important;
  }
  main > section[data-screen-label="Hero"] > .sc-host[data-sc-name="HeroShot"] figcaption { display: none; }
  main > section[data-screen-label="Hero"] > .sc-host[data-sc-name="HeroShot"] {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--hs-pad) + var(--hs-span) * 0.433), transparent calc(var(--hs-pad) + var(--hs-span))),
      linear-gradient(180deg, #000 50%, transparent min(calc(50% + var(--hs-fh) * 0.46), calc(100% - 6px)));
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, #000 calc(var(--hs-pad) + var(--hs-span) * 0.433), transparent calc(var(--hs-pad) + var(--hs-span))),
      linear-gradient(180deg, #000 50%, transparent min(calc(50% + var(--hs-fh) * 0.46), calc(100% - 6px)));
    mask-composite: intersect;
  }
}

/* Heroes take the screen they open on (owner, 2026-11-09): wide screens, text centred vertically */
@media (min-width: 1000px) {
  .md-hero { min-height: min(880px, calc(100svh - 120px)); display: flex; align-items: center; }
  .md-hero > div:last-child { width: 100%; }
  main > section[data-screen-label="Hero"]:has(> .sc-host[data-sc-name="HeroShot"]) {
    min-height: max(min(820px, calc(100svh - 150px)), calc(var(--hs-fh) * 1.06 + 24px)); display: flex !important; align-items: center;
  }
  main > section[data-screen-label="Hero"]:has(> .sc-host[data-sc-name="HeroShot"]) > div:first-child { padding-top: 0; }
}

/* Form fields in the site's own look: a quiet field, our chevron, our focus ring; where the browser
   allows it (appearance: base-select) the open list too */
select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%238C94A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px !important;
  cursor: pointer;
}
select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--md-color-accent); outline-offset: 2px;
}
@supports (appearance: base-select) {
  select { appearance: base-select; background-image: none; }
  select::picker-icon { color: var(--md-color-text-faint); transition: rotate .2s; }
  select:open::picker-icon { rotate: 180deg; }
  select::picker(select) {
    appearance: base-select; margin-top: 6px; padding: 6px; border: 1px solid var(--md-color-border);
    border-radius: 14px; background: var(--md-color-raised); color: var(--md-color-text); box-shadow: var(--md-shadow-lg);
  }
  select option { padding: 9px 12px; border-radius: 8px; font-size: 14px; }
  select option:hover, select option:focus-visible { background: var(--md-color-sunken); }
  select option:checked { background: var(--md-color-accent-weak); font-weight: 600; }
  select option::checkmark { color: var(--md-color-accent); }
}
input::placeholder, textarea::placeholder { color: var(--md-color-text-faint); opacity: 1; }

/* The nav loads its two dialogs (request, checkout) as separate templates; until they arrive the runtime draws a
   2 px placeholder for each, which collapses seconds later and moves the page up. The dialogs are fixed overlays,
   so their placeholders never need space. */
.sc-host[data-sc-name="SiteNav"] .sc-placeholder { display: none !important; }

/* Logo tiles everywhere follow the theme (owner, 2026-11-09): a dark tile at night, a white one by day. Dark
   one-colour marks are inverted at night by the rule at the top; colour marks keep their colours. A tile that
   links to its integration page lifts its edge on hover. */
.md-logo-tile { background: var(--md-color-surface) !important; border: 1px solid var(--md-color-border) !important; }
[data-theme="light"] .md-logo-tile { background: #ffffff !important; }
a.md-logo-tile { transition: border-color .2s, transform .2s; }
a.md-logo-tile:hover, a.md-logo-tile:focus-visible { border-color: var(--md-color-border-strong) !important; transform: translateY(-2px); }

/* While Inter loads the text is drawn in Arial sized to the same metrics, so lines do not re-wrap and nothing moves
   when the web font arrives (metrics of Inter against Arial). */
@font-face { font-family: "Inter Fallback"; src: local("Arial"), local("Helvetica"), local("Liberation Sans"); size-adjust: 107.4%; ascent-override: 90.2%; descent-override: 22.48%; line-gap-override: 0%; }
:root, [data-theme] { --md-font-family-sans: "Inter", "Inter Fallback", -apple-system, "Segoe UI", "Roboto", system-ui, sans-serif; }

/* Ultra-narrow screens (320-420px): allow long pill buttons and anchor chips to wrap inside their container without clipping. */
@media (max-width: 420px) {
  main a, main button { max-width: 100%; box-sizing: border-box; white-space: normal !important; height: auto !important; min-height: 36px; }
}
