/*
 * Design tokens for the redesigned pages (RIV-2600). A page sets its palette
 * with <body data-page="home|solutions|technologies|commerce">; each section
 * picks one of the page's tones with data-tone="light|alt|dark|accent".
 *
 * Light is the default everywhere. Every page ships a dark variant, picked
 * with <html data-theme="dark"> (the template's boot script applies the
 * stored choice before first paint).
 *
 * Contrast notes (WCAG AA, 4.5:1 for body text, 3:1 for 24px+ or 19px bold):
 * - Home gray #757575 passes on white (4.6) but not on #F2F2F2 (4.1): on the
 *   alt tone use it for large text only.
 * - Blue #235CF2 on Home's dark base is 3.5: fills, rules and 24px+ text
 *   only; smaller blue text there uses --accent-text (#7D9CFF, 7.3).
 * - Orange text #B85C00 passes on white (4.6) but not on Commerce's warm
 *   #FBF8F5 (4.3): there, large text only or on a white card.
 * - Logo red #C2000B on dark is 3.1: large text only; small red text on
 *   dark uses #FF7A7A (already used on Technologies).
 */
:root {
  color-scheme: light;
  /* Brand, logo values */
  --rv-blue: #235cf2;
  --rv-blue-deep: #1a47c2;
  --rv-green: #04b704;
  --rv-green-text: #037a03;
  --rv-red: #c2000b;
  --rv-red-text-dark: #ff7a7a;
  --rv-orange: #ff8001;
  --rv-orange-text: #ad5600; /* 4.8:1 on the cream (#B85C00 was 4.34) */

  /* Type */
  --font-display: Jost, 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: clamp(17px, 1.3vw, 19px);
  --text-xl: clamp(20px, 1.8vw, 24px);
  --display-sm: clamp(28px, 2.8vw, 42px);
  --display-md: clamp(32px, 4.2vw, 60px);
  --display-lg: clamp(40px, 6vw, 96px);
  --display-xl: clamp(56px, 10.5vw, 176px);
  --display-giant: 13.2vw;
  --leading-tight: 0.92;
  --leading-display: 1.02;
  --leading-body: 1.55;
  --tracking-display: -0.015em;
  --tracking-giant: -0.03em;
  --tracking-mono: 0.14em;

  /* Space */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --space-9: 96px;
  --section-pad: clamp(96px, 12vw, 168px);
  --wrap: 1360px;
  --gutter: clamp(16px, 3vw, 40px);
  --hairline: 1px;

  /* Motion. One easing for every entrance, exit and change across the site
     (--ease; --ease-out and --ease-emph are kept as its names). --ease-in-out
     is only for symmetric motion scrubbed by the scroll or looped, and the
     spring only for badges, pins and chips. */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: var(--ease);
  --ease-emph: var(--ease);
  --ease-in-out: cubic-bezier(0.45, 0, 0.2, 1);
  /* A spring with one small overshoot (to ~1.04), sampled as linear() so the
     same curve drives transitions and animations. Badges, pins, chips. */
  --ease-spring: linear(
    0,
    0.009,
    0.035 7.1%,
    0.141 12.4%,
    0.281 17%,
    0.723 27.5%,
    0.938 33.6%,
    1.017 37.5%,
    1.077 41.6%,
    1.121 46.2%,
    1.038 57.4%,
    0.996 64.1%,
    0.986 70.8%,
    1.001 85.5%,
    1
  );
  /* The duration scale: hover and state (fast, base), panels and fades
     (slow), reveals of copy (reveal), media changes and settles (media),
     page-to-page (page). A photo always enters from --media-from to 1. */
  --dur-fast: 160ms;
  --dur-base: 280ms;
  --dur-slow: 560ms;
  --dur-reveal: 900ms;
  --dur-media: 1400ms;
  --dur-page: 420ms;
  --dur-pop: 620ms;
  --stagger-step: 80ms;
  --line-step: 90ms;
  --media-from: 1.08;

  /* Corners: one rule for every page. Buttons, chips and fields are pills;
     cards, photos, panels and boards are --card-radius; a big floating
     panel is --radius-lg; a badge or a box nested inside a card steps down
     to --radius-sm so the curves stay concentric. Nothing is square. */
  --btn-radius: 999px;
  --card-radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 8px;
}

/* Labels. Everything that is set in --font-mono (section labels, stat
   captions, the board's statuses, the tracker, the header and footer
   labels) is IBM Plex Mono only on Technologies, the code skin. Home,
   Solutions and Commerce set it in IBM Plex Sans Medium: each rule already
   brings its own size, capitals and --tracking-mono (0.14em). */
[data-page='home'],
[data-page='solutions'],
[data-page='commerce'] {
  --font-mono: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  /* The EN · ES pair in the header and footer (Technologies keeps 600 and
     0.08em). */
  --lang-weight: 500;
  --lang-track: var(--tracking-mono);
}

/* Page palettes. Inks: --ink/--ink-muted on light and alt tones,
   --ink-inverse/--ink-inverse-muted on dark; --accent-ink on the accent tone.
   --surface is a card lifted off the page's own background. The legal
   pages take Home's palette. */
[data-page='home'],
[data-page='legal'] {
  --tone-light: #ffffff;
  --tone-alt: #f2f2f2;
  --tone-dark: #070707;
  --tone-accent: var(--rv-blue);
  --ink: #070707;
  --ink-muted: #757575;
  --ink-inverse: #ffffff;
  --ink-inverse-muted: rgba(255, 255, 255, 0.72);
  --accent: var(--rv-blue);
  --accent-text: var(--rv-blue);
  --accent-ink: #ffffff;
  --surface: #ffffff;
  --rule: #e2e2e2;
  --rule-inverse: rgba(255, 255, 255, 0.16);
}

/* Home, dark: the same four colors with the surfaces turned over. Inverse
   inks swap too, so anything sitting on the blue band keeps its contrast.
   data-theme is on <html> and data-page on <body>, hence the descendant. */
[data-theme='dark'] [data-page='home'],
[data-theme='dark'] [data-page='legal'] {
  --tone-light: #0d0d0d;
  --tone-alt: #151515;
  --tone-dark: #070707;
  --ink: #f4f4f4;
  --ink-muted: #a9a9a9;
  --ink-inverse: #070707;
  --ink-inverse-muted: rgba(7, 7, 7, 0.7);
  --accent-text: #7d9cff;
  --surface: #1b1b1b;
  --rule: rgba(255, 255, 255, 0.16);
  --rule-inverse: rgba(7, 7, 7, 0.14);
}

[data-page='solutions'] {
  --tone-light: #ffffff;
  --tone-alt: #f5f6f8;
  --tone-dark: #111418;
  --tone-accent: var(--rv-green-text);
  --ink: #0b0d12;
  --ink-muted: #3a404c;
  --ink-inverse: #ffffff;
  --ink-inverse-muted: #a3aab6;
  --accent: var(--rv-green);
  --accent-text: var(--rv-green-text);
  --accent-ink: #ffffff;
  --accent-tint: #e6f7e6;
  --surface: #ffffff;
  --rule: #dee1e7;
  --rule-inverse: #2a2f38;
}

/* Solutions, dark: the floor with the lights down. The hero and the way out
   stay on #037A03 in both themes (white on it is 5.5:1); small green text
   climbs to #04B704, which is 6.9 on the base and too light on white. */
[data-theme='dark'] [data-page='solutions'] {
  --tone-light: #0d100e;
  --tone-alt: #121613;
  --tone-dark: #080a09;
  --ink: #f2f5f3;
  --ink-muted: #a8b2ac;
  --accent-text: var(--rv-green);
  --accent-tint: #142218;
  --surface: #171c19;
  --rule: rgba(255, 255, 255, 0.14);
}

/* Technologies is the engineering side, and red on dark is its signature.
   That signature is not a theme: --tone-dark is the same near-black in both,
   so the hero and Orchy keep their stage at the site's default light theme
   and only the reading sections (team, Open Build, contact) follow the
   choice. Hence --ink-inverse and --accent-ink are declared once, here, and
   the dark block below leaves them alone: anything on the stage has to stay
   white in both themes. Small red text on the stage is #FF7A7A, which is
   what [data-tone='dark'] switches --accent-text to (technologies.css);
   #C2000B is kept for light surfaces, where it is 6.4 on white and 5.7 on
   the alt gray. */
[data-page='technologies'] {
  --tone-light: #ffffff;
  --tone-alt: #f2f3f5;
  --tone-dark: #0b0d12;
  --tone-accent: var(--rv-red);
  --ink: #0b0d12;
  --ink-muted: #3a404c;
  --ink-inverse: #ffffff;
  --ink-inverse-muted: #b7bdc9;
  --accent: var(--rv-red);
  --accent-text: var(--rv-red);
  --accent-ink: #ffffff;
  --accent-tint: #ffeced;
  --surface: #ffffff;
  --rule: #e2e4e9;
  --rule-inverse: #262c38;
}

/* Technologies, dark: the whole page becomes the stage it already carries,
   on the same near-blacks the page wore before it moved to tokens. */
[data-theme='dark'] [data-page='technologies'] {
  --tone-light: #12151c;
  --tone-alt: #0e1014;
  --ink: #ffffff;
  --ink-muted: #b7bdc9;
  --accent-text: var(--rv-red-text-dark);
  --accent-tint: #2a1416;
  --surface: #1a1e27;
  --rule: #262c38;
}

/* Commerce wears the store's own colors: warm cream, near-black brown and
   the orange. Cards are lifted off the cream. */
[data-page='commerce'] {
  --tone-light: #fbf8f5;
  --tone-alt: #ffffff;
  --tone-dark: #1a1512;
  --tone-accent: var(--rv-orange);
  --ink: #0b0d12;
  --ink-muted: #545b69;
  --ink-inverse: #ffffff;
  --ink-inverse-muted: #c6bcb3;
  --accent: var(--rv-orange);
  --accent-text: var(--rv-orange-text);
  --accent-ink: #0b0d12;
  --accent-tint: #fff4ea;
  --surface: #ffffff;
  --rule: #e6dfd8;
  --rule-inverse: rgba(255, 255, 255, 0.16);
  /* The store's chrome: its near-black brown bar and the chip on a photo. */
  --chrome: #241c17;
  --chrome-ink: #ffffff;
}

/* Commerce, dark: the same store, lights down. The cream turns into the
   warm near-black brown the store's own header already uses, and the orange
   is untouched — it is the one thing that must not shift. #B85C00 is far too
   dark here, so orange text goes up to #FF9A33 (7.0 on the base). */
[data-theme='dark'] [data-page='commerce'] {
  --tone-light: #15110e;
  --tone-alt: #1d1815;
  --tone-dark: #0d0a08;
  --ink: #f6f1ec;
  --ink-muted: #b3a89f;
  --ink-inverse: #ffffff;
  --ink-inverse-muted: #c6bcb3;
  --accent-text: #ff9a33;
  --accent-tint: #2a211a;
  --surface: #221c18;
  --rule: rgba(255, 255, 255, 0.14);
  /* Lifted, not sunk: in the dark theme the store's chrome has to read as a
     raised surface (search field, active chip, ink buttons), and anything
     darker than --tone-light disappears into the page. */
  --chrome: #2f2621;
}
