/* ===========================================================================
   SplitGoGo shared foundation.

   THIS FILE IS LOADED BY THREE SURFACES:
     1. marketing/landing.html      (plus landing.css on top)
     2. marketing/legal/_base.html  (Terms, Privacy, DPA, Subprocessors)
     3. portal/_base.html           (plus portal.css on top)

   So it holds ONLY what all three share: tokens, the type system, buttons,
   header, footer, form fields, the legal page, and the portal compat block.
   Landing-page composition (hero, figures, bento, case study) lives in
   landing.css and must not leak back in here.

   Brand tokens are the source of truth in brand/BRAND.md: deep pine ink
   (#0F3D38) + mint accent (#57C4A3). Nothing here invents brand values.

   Conventions:
     - Radius system (one scale, applied consistently):
         surfaces (cards, panels)   -> var(--r-surface)  16px
         controls (buttons, inputs) -> var(--r-control)  10px
         pills    (tags, badges)    -> var(--r-pill)     999px
     - Accent splits in two: --accent / --accent-dark are FILL colours,
       --accent-text is the legibility-tuned variant for accent-coloured
       strings. Never set small type in --accent on a light surface.
     - Motion is opt-in per element and always collapses under
       prefers-reduced-motion. Scroll reveals are armed by landing.js and are
       pure enhancement: every element renders visible by default.
   =========================================================================== */

/* ------------------------------------------------------------------ font -- */
/* Instrument Sans + IBM Plex Mono, self-hosted, both SIL Open Font License.
   This resolves the open question in BRAND.md: the brand face is Instrument
   Sans, not the system stack and not Inter.

   Why not Geist, which this file used first: a survey of eighteen fintech and
   developer-infrastructure sites found Geist is now one of the small set of
   faces that AI tooling reaches for by default, alongside Inter and Space
   Grotesk. The peer set either licenses a face (Suisse Int'l at Column and
   Unit, ABC Monument Grotesk at Persona and Lithic, Untitled Sans at
   Increase) or tunes a free one hard. Instrument Sans is the free face that
   reads closest to that group without carrying the default signal.

   Latin subset only. */
@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Numerals only. Every figure the product computed is set in this, with
   tabular spacing, so money never jitters between rows. */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- tokens -- */
:root {
  /* brand (fixed, from BRAND.md) */
  --ink: #0f3d38;
  --ink-soft: #2f5b56;
  --accent: #57c4a3;
  --accent-dark: #3da588;

  /* Accent for TEXT. The mint accent is a fill colour: #3da588 only reaches
     ~3.0:1 on white, so it fails WCAG AA for small type. This token is the
     accent tuned for legibility (about 5.9:1 on white) and is what every
     accent-coloured string uses. --accent / --accent-dark stay reserved for
     fills, borders, and large or decorative shapes. */
  --accent-text: #27705c;

  /* semantic surfaces, light mode. The neutrals carry a trace of the brand
     hue rather than being pure grey, so the page reads as one material. */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f8f7;
  --surface-3: #eaf2f0;
  --text: #0c2e2a;
  --text-muted: #556966;
  --border: #e2ebe9;
  --border-strong: #c8dad6;

  /* the ink block: dark brand surface used inside a light page */
  --ink-surface: #0c332e;
  --ink-surface-2: #124840;
  --ink-text: #eaf3f1;
  --ink-text-muted: #a4c1bc;
  --ink-border: rgba(255, 255, 255, 0.13);

  /* accent-on-surface tints */
  --accent-wash: rgba(87, 196, 163, 0.1);
  --accent-wash-strong: rgba(87, 196, 163, 0.18);

  /* feedback */
  --danger: #b3261e;
  --danger-bg: #fdf0ef;
  --success-bg: #e6f6f0;

  /* Radius scale. Deliberately tight. A 16px surface radius is the single
     most recognisable "component library default" in current web design; the
     comparable fintech and infrastructure sites sit at 2-8px for surfaces
     (Stripe's dominant value is 4px, Increase and Column use 2px) and reserve
     the full pill for tags. That contrast is the system, not a uniform token. */
  --r-surface: 10px;
  --r-control: 8px;
  --r-pill: 999px;

  /* elevation, tinted to the brand hue rather than pure black */
  --shadow-sm: 0 1px 2px rgba(12, 46, 42, 0.05);
  --shadow-md: 0 4px 16px -4px rgba(12, 46, 42, 0.1), 0 2px 6px -2px rgba(12, 46, 42, 0.06);
  --shadow-lg: 0 24px 48px -16px rgba(12, 46, 42, 0.18), 0 8px 20px -8px rgba(12, 46, 42, 0.1);

  /* type */
  --font-sans:
    "Instrument Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono:
    "IBM Plex Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  /* Type scale. One ratio, used everywhere, so nothing is set ad hoc. */
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.1875rem;
  --step-2: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);
  --step-3: clamp(1.875rem, 1.45rem + 2vw, 2.875rem);
  --step-4: clamp(2.5rem, 1.7rem + 3.6vw, 4.25rem);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* Header height is a token because the hero pulls itself up by exactly this
     much to run full-bleed underneath a transparent header. If the two ever
     disagree the hero sits in a visible ditch, so they read one value. */
  --header-h: 70px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071815;
    --surface: #0d2521;
    --surface-2: #0a1f1c;
    --surface-3: #123029;
    --text: #e8f2f0;
    --text-muted: #9ab4b0;
    --border: #1b3a32;
    --border-strong: #27554d;

    /* in dark mode the ink block sits slightly above the page, not below it,
       so it still reads as a distinct brand surface instead of disappearing */
    --ink-surface: #0b2a26;
    --ink-surface-2: #123b34;
    --ink-border: rgba(255, 255, 255, 0.1);

    /* on dark surfaces the legible accent is the light mint, not the dark one */
    --accent-text: #6fd3b4;

    --accent-wash: rgba(87, 196, 163, 0.12);
    --accent-wash-strong: rgba(87, 196, 163, 0.2);

    --danger: #f2b8b5;
    --danger-bg: #2c1512;
    --success-bg: #0f3229;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.6);
  }
}

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

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: var(--step-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

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

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink-surface);
  color: var(--ink-text);
  padding: 12px 20px;
  border-radius: 0 0 var(--r-control) 0;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ type -- */
/* Display type is set tight and heavy. The optical-size and tracking values
   are the single biggest signal that the page was designed rather than
   assembled, so they are tokenised here and never overridden per section. */
h1,
h2,
h3 {
  line-height: 1.08;
  letter-spacing: -0.032em;
  font-weight: 620;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-4);
  letter-spacing: -0.042em;
  line-height: 1.02;
}

h2 {
  font-size: var(--step-3);
  letter-spacing: -0.036em;
  margin-bottom: 14px;
}

h3 {
  font-size: var(--step-1);
  letter-spacing: -0.018em;
  line-height: 1.3;
  margin-bottom: 8px;
}

.lead {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 44ch;
  text-wrap: pretty;
}

.section-intro {
  color: var(--text-muted);
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: 56ch;
  text-wrap: pretty;
}

/* Tabular figures for every number the product computed. Money that jitters
   between rows because the digits are proportional reads as untrustworthy. */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.011em;
  line-height: 1;
  padding: 14px 24px;
  min-height: 46px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.18s var(--ease),
    border-color 0.18s var(--ease),
    transform 0.12s var(--ease),
    box-shadow 0.18s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

/* accent fill: ink text on mint always clears WCAG AA (contrast ~7.4:1) */
.btn-primary {
  background: var(--accent);
  color: #0c2e2a;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-wash);
}

/* on ink blocks the secondary needs its own stroke and text colour */
.on-ink .btn-secondary {
  color: var(--ink-text);
  border-color: rgba(255, 255, 255, 0.26);
}

.on-ink .btn-secondary:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
}

.btn-sm {
  padding: 10px 17px;
  min-height: 40px;
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------- header -- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.site-header img {
  height: 29px;
  width: auto;
  display: block;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 520;
  letter-spacing: -0.011em;
  white-space: nowrap;
  padding: 8px 13px;
  border-radius: var(--r-control);
  transition: background-color 0.18s var(--ease);
}

.nav-link:hover {
  background: var(--surface-2);
}

/* The header sits on the dark hero at rest and turns solid once the page
   scrolls. landing.js sets data-scrolled; without JS it stays solid, which is
   the safe end of the fallback. */
.site-header[data-scrolled="false"] {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: transparent;
}

.site-header[data-scrolled="false"] .nav-link {
  color: var(--ink-text);
}

.site-header[data-scrolled="false"] .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.site-header[data-scrolled="false"] .brand img {
  filter: brightness(0) invert(1);
}

/* the logo ships as a dark-ink raster, so lift it in dark mode */
@media (prefers-color-scheme: dark) {
  .site-header img {
    filter: brightness(0) invert(1) opacity(0.92);
  }
}

/* --------------------------------------------------------------- surfaces -- */
/* Generic surface primitives. They live here rather than in landing.css
   because the button rules above already style .btn inside .on-ink, and a
   surface whose definition is split across two files drifts. */
.section {
  padding: clamp(72px, 9vw, 128px) 0;
}

.section-soft {
  background: var(--surface-2);
}

/* ink block: a deliberate dark brand surface inside the light page. The page
   opens and closes on ink and is light in between, which is one intentional
   colour-block story rather than sections flipping theme at random. */
.on-ink {
  background: var(--ink-surface);
  color: var(--ink-text);
}

.on-ink h1,
.on-ink h2,
.on-ink h3 {
  color: #ffffff;
}

.on-ink .lead,
.on-ink .section-intro,
.on-ink p {
  color: var(--ink-text-muted);
}

/* Links on ink take the mint, but buttons must keep their own colour: a
   .btn-primary is mint-filled, so inheriting mint text would render the label
   invisible. :not(.btn) keeps this rule off every button on an ink surface. */
.on-ink a:not(.btn) {
  color: var(--accent);
}

/* ------------------------------------------------------------ form fields -- */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.008em;
  margin-bottom: 7px;
  color: var(--text);
}

.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 0.9375rem;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  background: var(--bg);
  color: var(--text);
  transition:
    border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

/* placeholder must still clear AA against the input background */
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px var(--accent-wash-strong);
}

.field .errors,
.errors {
  color: var(--danger);
  font-size: 0.8125rem;
  margin-top: 6px;
  list-style: none;
}

.form-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 14px;
  text-align: center;
}

.success {
  background: var(--success-bg);
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: var(--r-surface);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.success strong {
  display: block;
  margin-bottom: 4px;
}

/* ---------------------------------------------------------------- footer -- */
.site-footer {
  background: var(--ink-surface);
  color: var(--ink-text-muted);
  padding: 48px 0;
}

.site-footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}

.site-footer img {
  height: 28px;
  width: auto;
}

.site-footer small {
  color: var(--ink-text-muted);
  font-size: 0.8125rem;
  line-height: 1.8;
}

.site-footer a {
  color: var(--ink-text);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ----------------------------------------------------------------- legal -- */
.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 28px 96px;
}

.legal h1 {
  font-size: clamp(1.85rem, 1.5rem + 1.4vw, 2.375rem);
  margin-bottom: 6px;
}

.legal h2 {
  font-size: 1.25rem;
  letter-spacing: -0.022em;
  margin: 40px 0 10px;
}

.legal p,
.legal li {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.75;
}

.legal ul {
  margin: 6px 0 0 22px;
}

.legal li {
  margin: 4px 0;
}

.legal .meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 40px;
}

.legal a {
  color: var(--accent-text);
}

/* =========================================================== portal compat ==
   The partner portal (portal/templates/portal/_base.html) loads THIS
   stylesheet before its own portal.css, and portal.css consumes the
   pre-redesign token names (--soft, --muted, --radius, --ink, --border,
   --accent, --accent-dark) plus the .btn-ghost class.

   This block keeps the portal rendering exactly as it did before the
   marketing redesign:
     - legacy token names are re-declared on body.portal
     - they are pinned to FIXED light values, so the portal does not inherit
       the marketing dark-mode palette (portal.css hardcodes #fff panels,
       which would leave light-grey text on white in dark mode)
     - .btn geometry is restored to the pre-redesign values

   Remove this block when the portal is restyled onto the new token set.
   ========================================================================== */
body.portal {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f8f7;
  --surface-3: #eaf2f0;
  --text: #0f3d38;
  --text-muted: #5a6b69;
  --border: #dde8e5;
  --border-strong: #c6d9d5;

  /* legacy names still referenced by portal.css */
  --soft: #f4f8f7;
  --muted: #5a6b69;
  --radius: 12px;
  --ink: #0f3d38;
  --accent: #57c4a3;
  --accent-dark: #3da588;

  color: var(--text);
  background: var(--surface-2);
}

body.portal .btn {
  min-height: 0;
  border-width: 2px;
  border-radius: var(--radius);
  padding: 12px 22px;
  font-size: 15px;
}

/* .btn-ghost was renamed .btn-secondary for the marketing site. The portal
   still uses the old name, so keep it as a working alias. */
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  border-color: var(--accent-dark);
  background: var(--accent-wash);
}

/* ---------------------------------------------------------------- motion -- */
/* Scroll reveal, progressive enhancement.

   Content is VISIBLE BY DEFAULT. landing.js adds .reveal-armed only when
   IntersectionObserver exists, the visitor has not asked for reduced motion,
   and the element is still below the fold. So no-JS, reduced motion, print,
   PDF export, and full-page screenshot capture all render the finished
   state. Nothing on this page can be hidden by a failed animation.

   An earlier pass used CSS scroll-driven animations (animation-timeline:
   view()). It left every below-fold section at opacity 0 in full-page
   renders, which is why this is JS-armed instead. */
.reveal-armed {
  opacity: 0;
  transform: translateY(20px);
}

.reveal-armed.is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}

@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;
  }
}

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 760px) {
  :root {
    --header-h: 62px;
  }

  /* keep the nav on one line at small widths by dropping the tertiary link
     and tightening the remaining spacing */
  .nav-link--secondary {
    display: none;
  }

  .site-nav {
    gap: 2px;
  }

  .site-nav .nav-link {
    padding: 8px 8px;
  }

  .site-nav .btn-sm {
    padding: 10px 13px;
  }

  .lead,
  .section-intro {
    max-width: none;
  }
}

/* Below ~440px the logo plus both nav items cannot share one line. Drop the
   header CTA rather than the login link: the hero "Request a demo" button is
   immediately below the fold, whereas "Partner login" has no other
   above-fold entry point. */
@media (max-width: 440px) {
  .site-nav .btn-primary {
    display: none;
  }
}

@media (max-width: 420px) {
  .wrap {
    padding: 0 20px;
  }

  .site-header img {
    height: 26px;
  }
}
