/* ==========================================================================
   CrossX design system — site.css
   Tokens (--cx-*) are the public contract: widgets.css consumes only these.
   Signature motif: crossing strokes, crosshair marks and grid intersections.
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */

:root {
  /* Light theme (default) */
  --cx-bg: #f6f7fa;
  --cx-surface: #ffffff;
  --cx-surface-2: #eef1f6;
  --cx-ink: #0b1220;
  --cx-ink-muted: #4a5468;
  --cx-line: #dce1ea;
  --cx-accent: #c2410c;        /* signal orange, 5.2:1 on white */
  --cx-accent-ink: #ffffff;    /* text on accent fills */
  --cx-accent-2: #0e7490;      /* cyan, 5.4:1 on white */
  --cx-focus: #0369a1;
  --cx-shadow: 0 1px 2px rgb(11 18 32 / 0.06), 0 14px 32px -14px rgb(11 18 32 / 0.22);
  --cx-grid: rgb(11 18 32 / 0.06);

  /* Theme-independent */
  --cx-radius: 8px;
  --cx-radius-lg: 14px;
  --cx-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --cx-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --cx-space-1: 4px;
  --cx-space-2: 8px;
  --cx-space-3: 12px;
  --cx-space-4: 16px;
  --cx-space-5: 24px;
  --cx-space-6: 32px;
  --cx-space-7: 48px;
  --cx-space-8: 72px;
  --cx-max: 1200px;
  --cx-gutter: clamp(16px, 4vw, 32px);
  --cx-header-h: 68px;
  --cx-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

/* Dark palette. Applied by explicit choice, by OS preference, and always on
   .ink bands (hero, CTA, footer) so those stay deep navy in both themes. */
:root[data-theme="dark"],
.ink {
  --cx-bg: #0a1020;
  --cx-surface: #111a2d;
  --cx-surface-2: #17223a;
  --cx-ink: #e8edf7;
  --cx-ink-muted: #a3aec4;
  --cx-line: #26324d;
  --cx-accent: #ff7a33;        /* 7.2:1 on #0a1020 */
  --cx-accent-ink: #0a1020;
  --cx-accent-2: #38d6f5;
  --cx-focus: #5ee0fa;
  --cx-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 18px 40px -18px rgb(0 0 0 / 0.7);
  --cx-grid: rgb(232 237 247 / 0.06);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cx-bg: #0a1020;
    --cx-surface: #111a2d;
    --cx-surface-2: #17223a;
    --cx-ink: #e8edf7;
    --cx-ink-muted: #a3aec4;
    --cx-line: #26324d;
    --cx-accent: #ff7a33;
    --cx-accent-ink: #0a1020;
    --cx-accent-2: #38d6f5;
    --cx-focus: #5ee0fa;
    --cx-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 18px 40px -18px rgb(0 0 0 / 0.7);
    --cx-grid: rgb(232 237 247 / 0.06);
    color-scheme: dark;
  }
}

/* In dark mode the page itself is near the ink bands, so bands go one step deeper. */
:root[data-theme="dark"] .ink { --cx-bg: #070c18; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ink { --cx-bg: #070c18; }
}

/* ---------- 2. Base ------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--cx-header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cx-bg);
  color: var(--cx-ink);
  font-family: var(--cx-font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; }
svg { flex-shrink: 0; }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}
h1 { font-size: clamp(2.35rem, 5.6vw, 4.4rem); letter-spacing: -0.035em; line-height: 1.02; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.75rem); }
h3, .h3 { font-size: 1.2rem; letter-spacing: -0.012em; line-height: 1.25; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--cx-accent); }

:focus-visible {
  outline: 3px solid var(--cx-focus);
  outline-offset: 3px;
  border-radius: 3px;
}
main:focus { outline: none; }

::selection { background: var(--cx-accent); color: var(--cx-accent-ink); }

.accent { color: var(--cx-accent); }

/* ---------- 3. Utilities ------------------------------------------------- */

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

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--cx-space-4);
  top: -100px;
  z-index: 100;
  padding: var(--cx-space-3) var(--cx-space-4);
  background: var(--cx-accent);
  color: var(--cx-accent-ink);
  font-weight: 700;
  border-radius: var(--cx-radius);
  text-decoration: none;
}
.skip-link:focus { top: var(--cx-space-3); color: var(--cx-accent-ink); }

/* Kicker: mono eyebrow led by a crosshair "+" */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: var(--cx-space-4);
  font-family: var(--cx-font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cx-accent);
}
.kicker::before {
  content: "";
  width: 11px; height: 11px;
  flex: none;
  background:
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat;
}

.lede {
  font-size: clamp(1.08rem, 1.6vw, 1.28rem);
  line-height: 1.55;
  color: var(--cx-ink-muted);
  max-width: 62ch;
}

.section-copy { color: var(--cx-ink-muted); max-width: 60ch; margin-top: var(--cx-space-4); }

/* Crosshair registration mark (decorative) */
.crosshair {
  position: absolute;
  width: 18px; height: 18px;
  color: var(--cx-accent);
  pointer-events: none;
  background:
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat;
}
.crosshair--tl { top: -9px; left: -9px; }
.crosshair--br { bottom: -9px; right: -9px; }

/* ---------- 4. Buttons, links, chips, cards ------------------------------ */

.button {
  --_bg: var(--cx-accent);
  --_fg: var(--cx-accent-ink);
  --_bd: var(--cx-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 46px;
  padding: 0.7em 1.25em;
  border: 1.5px solid var(--_bd);
  border-radius: var(--cx-radius);
  background: var(--_bg);
  color: var(--_fg);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms var(--cx-ease), background-color 160ms, border-color 160ms, color 160ms, box-shadow 160ms;
}
.button:hover {
  color: var(--_fg);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--cx-accent) 70%, transparent);
}
.button:active { transform: translateY(0); }

.button--ghost {
  --_bg: transparent;
  --_fg: var(--cx-ink);
  --_bd: var(--cx-line);
}
.button--ghost:hover {
  --_bd: var(--cx-ink);
  color: var(--cx-ink);
  box-shadow: none;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-weight: 650;
  color: var(--cx-ink);
  text-decoration: none;
  border-bottom: 1.5px solid var(--cx-accent);
  padding-bottom: 2px;
}
.text-link::after { content: "→"; transition: transform 160ms var(--cx-ease); }
.text-link:hover { color: var(--cx-accent); }
.text-link:hover::after { transform: translateX(3px); }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cx-space-3);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.32em 0.7em;
  border: 1px solid var(--cx-line);
  border-radius: 4px;
  background: var(--cx-surface-2);
  color: var(--cx-ink);
  font-family: var(--cx-font-mono);
  font-size: 0.78rem;
  line-height: 1.3;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cx-space-2);
  list-style: none;
}

.card {
  position: relative;
  padding: var(--cx-space-5);
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-radius-lg);
  background: var(--cx-surface);
  color: var(--cx-ink);
}
.card h3 { margin-bottom: var(--cx-space-2); }
.card p { color: var(--cx-ink-muted); }
.card--link {
  display: flex;
  flex-direction: column;
  gap: var(--cx-space-2);
  text-decoration: none;
  transition: transform 200ms var(--cx-ease), border-color 200ms, box-shadow 200ms;
}
.card--link:hover {
  color: var(--cx-ink);
  border-color: color-mix(in srgb, var(--cx-accent) 55%, var(--cx-line));
  box-shadow: var(--cx-shadow);
  transform: translateY(-2px);
}

.card-grid {
  display: grid;
  gap: var(--cx-space-4);
  list-style: none;
}
.card-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- 5. Header & navigation -------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--cx-line);
  background: color-mix(in srgb, var(--cx-bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  backdrop-filter: saturate(150%) blur(14px);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--cx-space-4);
  min-height: var(--cx-header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--cx-ink);
  text-decoration: none;
  margin-right: auto;
}
.brand:hover { color: var(--cx-ink); }
.brand__word {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.brand__word span { color: var(--cx-accent); }
.logo-mark { width: 32px; height: 32px; }
.logo-mark__frame { opacity: 0.45; }
.logo-mark__over { stroke: var(--cx-accent); }
.brand:hover .logo-mark__over { stroke: var(--cx-accent-2); }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--cx-space-5);
}
.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--cx-space-1);
  list-style: none;
}
.site-nav__list a {
  position: relative;
  display: block;
  padding: 0.5em 0.7em;
  border-radius: 6px;
  color: var(--cx-ink-muted);
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
}
.site-nav__list a:hover { color: var(--cx-ink); background: var(--cx-surface-2); }
.site-nav__list a[aria-current="page"] { color: var(--cx-ink); }
.site-nav__list a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.7em; right: 0.7em; bottom: 0.15em;
  height: 2px;
  background: var(--cx-accent);
}
.site-nav__cta { min-height: 40px; padding: 0.55em 1em; font-size: 0.92rem; }

.theme-toggle,
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--cx-line);
  border-radius: var(--cx-radius);
  background: transparent;
  color: var(--cx-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.theme-toggle:hover,
.nav-toggle:hover { border-color: var(--cx-ink); }

/* Show the icon for the theme you would switch TO. */
.theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle__moon { display: none; }
}
/* Without JS the toggles can't work, so don't offer them. */
:root:not(.js) .theme-toggle,
:root:not(.js) .nav-toggle { display: none; }

.nav-toggle { display: none; order: 2; }
.theme-toggle { order: 3; }

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 200ms var(--cx-ease), opacity 200ms;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -5px; }
.nav-toggle__bars::after { top: 5px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 1020px) {
  .site-header__inner { flex-wrap: wrap; gap: var(--cx-space-3); }
  .brand { order: 1; }
  .site-nav { order: 4; }

  /* No JS: the nav stays visible as a scrollable row under the brand. */
  :root:not(.js) .site-nav {
    flex-basis: 100%;
    overflow-x: auto;
    padding-bottom: var(--cx-space-3);
    gap: var(--cx-space-3);
  }
  :root:not(.js) .site-nav__list { flex: none; }
  :root:not(.js) .site-nav__list a { white-space: nowrap; }
  :root:not(.js) .site-nav__cta { flex: none; white-space: nowrap; }

  /* With JS: collapsed panel opened by [data-nav-toggle][aria-expanded=true]. */
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: var(--cx-space-4);
    padding: var(--cx-space-2) 0 var(--cx-space-5);
  }
  .js .site-header:has([data-nav-toggle][aria-expanded="true"]) .site-nav,
  .js [data-nav-toggle][aria-expanded="true"] ~ .site-nav,
  .js .site-nav.is-open,
  .js .site-nav[data-open="true"] { display: flex; }
  .js .site-nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .js .site-nav__list a {
    padding: 0.85em 0.25em;
    border-bottom: 1px solid var(--cx-line);
    border-radius: 0;
    font-size: 1.05rem;
    color: var(--cx-ink);
  }
  .js .site-nav__list a:hover { background: transparent; color: var(--cx-accent); }
  .js .site-nav__list a[aria-current="page"]::after { left: auto; right: 0.25em; top: 50%; bottom: auto; width: 8px; height: 8px; transform: translateY(-50%); }
  .js .site-nav__cta { min-height: 48px; }
}
@media (max-width: 480px) {
  .nav-toggle__text { display: none; }
}

/* ---------- 6. Ink bands, hero ------------------------------------------ */

.ink {
  position: relative;
  background-color: var(--cx-bg);
  color: var(--cx-ink);
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(72px, 12vw, 148px) clamp(64px, 9vw, 112px);
  background-image:
    radial-gradient(60% 70% at 85% 30%, color-mix(in srgb, var(--cx-accent) 16%, transparent), transparent 70%),
    radial-gradient(50% 60% at 10% 100%, color-mix(in srgb, var(--cx-accent-2) 12%, transparent), transparent 70%),
    linear-gradient(var(--cx-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--cx-grid) 1px, transparent 1px);
  background-size: auto, auto, 56px 56px, 56px 56px;
  background-position: center, center, -1px -1px, -1px -1px;
}
/* Background layer for widgets/hero-canvas.html: fills the hero, sits under the copy. */
.hero__canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__canvas > * { width: 100%; height: 100%; }
.hero__canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Soft scrim keeps text contrast stable over anything the canvas draws. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--cx-bg) 0%, color-mix(in srgb, var(--cx-bg) 70%, transparent) 45%, transparent 80%);
}
.hero__inner {
  position: relative;
  z-index: 1;
  pointer-events: none; /* let pointer movement reach the canvas... */
}
.hero__inner a,
.hero__inner button,
.hero__inner p,
.hero__inner h1 { pointer-events: auto; } /* ...but keep text selectable and controls usable */
.hero h1 { max-width: 15ch; margin-bottom: var(--cx-space-5); }
.hero h1 .accent { display: block; }
.hero .lede { margin-bottom: var(--cx-space-6); }

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cx-space-2) var(--cx-space-5);
  margin-top: var(--cx-space-7);
  list-style: none;
  font-family: var(--cx-font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--cx-ink-muted);
}
.meta-list li { display: inline-flex; align-items: center; gap: 0.6em; }
.meta-list li::before {
  content: "";
  width: 9px; height: 9px;
  background:
    linear-gradient(var(--cx-accent), var(--cx-accent)) center / 1.5px 100% no-repeat,
    linear-gradient(var(--cx-accent), var(--cx-accent)) center / 100% 1.5px no-repeat;
}

/* Sub-page hero */
.page-hero {
  overflow: hidden;
  isolation: isolate;
  padding-block: clamp(64px, 9vw, 112px) clamp(56px, 7vw, 88px);
  border-bottom: 1px solid var(--cx-line);
}
.page-hero__grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--cx-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--cx-grid) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  -webkit-mask-image: linear-gradient(100deg, transparent 15%, #000 75%);
  mask-image: linear-gradient(100deg, transparent 15%, #000 75%);
}
/* Large crossing strokes: the X signature, drawn in CSS */
.page-hero::before,
.page-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  right: max(-80px, calc((100vw - var(--cx-max)) / 2 - 120px));
  width: min(52vw, 560px);
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--cx-line) 20%, var(--cx-line) 80%, transparent);
  transform-origin: center;
}
.page-hero::before { transform: rotate(32deg); }
.page-hero::after {
  transform: rotate(-32deg);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--cx-accent) 70%, transparent) 25%, var(--cx-accent) 50%, color-mix(in srgb, var(--cx-accent) 70%, transparent) 75%, transparent);
  opacity: 0.55;
}
.page-hero h1 { max-width: 20ch; margin-bottom: var(--cx-space-5); }
.page-hero .meta-list { margin-top: var(--cx-space-6); }
.page-hero__inner { position: relative; }

/* ---------- 7. Sections -------------------------------------------------- */

.section {
  position: relative;
  padding-block: clamp(64px, 9vw, 120px);
}
.section--alt {
  background: var(--cx-surface-2);
  border-block: 1px solid var(--cx-line);
}
.section--grid { isolation: isolate; }
.section--grid::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--cx-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--cx-grid) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent);
  mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: end;
  gap: var(--cx-space-5) var(--cx-space-7);
  margin-bottom: clamp(32px, 5vw, 56px);
}
.section-head h2 { max-width: 20ch; }
.section-head__copy { color: var(--cx-ink-muted); max-width: 52ch; }
.section-foot { margin-top: var(--cx-space-6); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--cx-space-7) clamp(32px, 6vw, 96px);
  align-items: start;
}
.split h2 { max-width: 18ch; }
.split .text-link { margin-top: var(--cx-space-5); }

/* ---------- 8. Home components ------------------------------------------ */

/* Proof strip: qualitative claims on a grid with crosshair intersections */
.proof {
  border-bottom: 1px solid var(--cx-line);
  background: var(--cx-surface);
}
.proof__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.proof__item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--cx-space-2);
  padding: var(--cx-space-6) var(--cx-space-5);
  border-left: 1px solid var(--cx-line);
}
.proof__item:last-child { border-right: 1px solid var(--cx-line); }
.proof__item::before {
  content: "";
  position: absolute;
  top: -6px; left: -6px;
  width: 11px; height: 11px;
  background:
    linear-gradient(var(--cx-accent), var(--cx-accent)) center / 1.5px 100% no-repeat,
    linear-gradient(var(--cx-accent), var(--cx-accent)) center / 100% 1.5px no-repeat;
}
.proof__item strong { font-size: 1.3rem; letter-spacing: -0.02em; line-height: 1.2; }
.proof__item span { color: var(--cx-ink-muted); font-size: 0.95rem; line-height: 1.5; }

/* Numbered service cards */
.service-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--cx-space-4);
}
.service-card {
  grid-column: span 3;
  display: flex;
  flex-direction: column;
  gap: var(--cx-space-3);
  min-height: 250px;
  text-decoration: none;
  overflow: hidden;
  transition: transform 220ms var(--cx-ease), border-color 220ms, box-shadow 220ms;
}
.service-card--featured { grid-column: span 6; min-height: 280px; }
.service-card h3 { font-size: 1.35rem; margin: 0; }
.service-card--featured h3 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); }
.service-card p { flex: 1; }
.service-card__index {
  font-family: var(--cx-font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--cx-accent);
}
.service-card__more {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--cx-ink);
}
.service-card__more::after { content: "→"; transition: transform 200ms var(--cx-ease); }
/* Crossing strokes reveal in the corner on hover */
.service-card::before,
.service-card::after {
  content: "";
  position: absolute;
  top: 22px; right: 22px;
  width: 26px; height: 2px;
  background: var(--cx-line);
  transition: background-color 220ms, transform 300ms var(--cx-ease);
}
.service-card::before { transform: rotate(45deg); }
.service-card::after { transform: rotate(-45deg); }
.service-card:hover,
.card--link:hover { color: var(--cx-ink); }
.service-card:hover {
  border-color: color-mix(in srgb, var(--cx-accent) 55%, var(--cx-line));
  box-shadow: var(--cx-shadow);
  transform: translateY(-3px);
}
.service-card:hover::after { background: var(--cx-accent); transform: rotate(-45deg) scaleX(1.3); }
.service-card:hover::before { transform: rotate(45deg) scaleX(1.3); }
.service-card:hover .service-card__more::after,
.card--link:hover .service-card__more::after { transform: translateX(4px); }
.service-card--featured {
  background:
    linear-gradient(var(--cx-grid) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--cx-grid) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--cx-surface);
}

/* Numbered list (senior principle, principles) */
.numbered-list {
  list-style: none;
  counter-reset: cx-num;
  border-top: 1px solid var(--cx-line);
}
.numbered-list li {
  counter-increment: cx-num;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  column-gap: var(--cx-space-4);
  padding-block: var(--cx-space-5);
  border-bottom: 1px solid var(--cx-line);
}
.numbered-list li::before {
  content: counter(cx-num, decimal-leading-zero);
  grid-row: span 2;
  font-family: var(--cx-font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cx-accent);
  padding-top: 0.2em;
}
.numbered-list h3 { margin-bottom: var(--cx-space-1); }
.numbered-list p { color: var(--cx-ink-muted); }

/* ---------- 9. Services detail rows ------------------------------------- */

.detail-list { border-top: 1px solid var(--cx-line); }
.detail-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: var(--cx-space-5) var(--cx-space-7);
  padding-block: clamp(32px, 5vw, 56px);
  border-bottom: 1px solid var(--cx-line);
}
.detail-row__index { display: flex; flex-direction: column; gap: var(--cx-space-1); }
.detail-row__num {
  font-family: var(--cx-font-mono);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
  color: var(--cx-accent);
  letter-spacing: -0.02em;
}
.detail-row__label {
  font-family: var(--cx-font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cx-ink-muted);
}
.detail-row__title { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.detail-row__body { display: grid; gap: var(--cx-space-5); }
.detail-row__body > p { color: var(--cx-ink-muted); font-size: 1.05rem; }

.checklist {
  display: grid;
  gap: var(--cx-space-2) var(--cx-space-5);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none;
}
.checklist li {
  position: relative;
  padding-left: 24px;
  font-size: 0.97rem;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 2px; top: 0.55em;
  width: 11px; height: 11px;
  background:
    linear-gradient(var(--cx-accent), var(--cx-accent)) center / 1.5px 100% no-repeat,
    linear-gradient(var(--cx-accent), var(--cx-accent)) center / 100% 1.5px no-repeat;
  transform: rotate(45deg);
}
.checklist--large {
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--cx-line);
}
.checklist--large li {
  padding: var(--cx-space-4) 0 var(--cx-space-4) 32px;
  border-bottom: 1px solid var(--cx-line);
  font-size: 1.05rem;
}
.checklist--large li::before { top: calc(var(--cx-space-4) + 0.55em); left: 4px; }

/* ---------- 10. Steps, roles, features, principles ---------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--cx-space-5);
  list-style: none;
  position: relative;
}
.step { position: relative; padding-top: 64px; }
/* connecting rail between nodes */
.step::before {
  content: "";
  position: absolute;
  top: 20px; left: 44px; right: calc(-1 * var(--cx-space-5));
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--cx-line) 0 6px, transparent 6px 12px);
}
.step:last-child::before { display: none; }
.step__node {
  position: absolute;
  top: 0; left: 0;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 1.5px solid var(--cx-accent);
  border-radius: 50%;
  background: var(--cx-bg);
  color: var(--cx-accent);
  font-family: var(--cx-font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}
.section--alt .step__node { background: var(--cx-surface-2); }
.step__label {
  font-family: var(--cx-font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cx-accent);
  margin-bottom: var(--cx-space-2);
}
.step h3 { margin-bottom: var(--cx-space-2); }
.step p:last-child { color: var(--cx-ink-muted); }

.role-card { display: flex; flex-direction: column; gap: var(--cx-space-2); }
.role-card h3 { margin: 0; }
.role-card p { flex: 1; font-size: 0.97rem; }
.role-card p.role-card__tags {
  flex: none;
  padding-top: var(--cx-space-3);
  border-top: 1px dashed var(--cx-line);
  font-family: var(--cx-font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  color: var(--cx-ink-muted);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  border-top: 1px solid var(--cx-line);
  border-left: 1px solid var(--cx-line);
}
.feature-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.feature {
  position: relative;
  padding: var(--cx-space-6) var(--cx-space-5);
  border-right: 1px solid var(--cx-line);
  border-bottom: 1px solid var(--cx-line);
}
.feature h3 { margin-bottom: var(--cx-space-2); }
.feature p { color: var(--cx-ink-muted); font-size: 0.98rem; }
.feature::after {
  content: "";
  position: absolute;
  right: -6px; bottom: -6px;
  z-index: 1;
  width: 11px; height: 11px;
  background:
    linear-gradient(var(--cx-ink-muted), var(--cx-ink-muted)) center / 1px 100% no-repeat,
    linear-gradient(var(--cx-ink-muted), var(--cx-ink-muted)) center / 100% 1px no-repeat;
  opacity: 0.6;
}

.principle { display: flex; flex-direction: column; gap: var(--cx-space-2); }
.principle__num {
  font-family: var(--cx-font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--cx-accent);
  margin-bottom: var(--cx-space-4);
}
.principle h3 { margin: 0; }

/* ---------- 11. Timeline ------------------------------------------------- */

.timeline {
  position: relative;
  list-style: none;
  max-width: 920px;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 8px; bottom: 8px;
  left: 92px;
  width: 1.5px;
  background: linear-gradient(var(--cx-accent), var(--cx-line) 40%, var(--cx-line));
}
.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: 64px;
  padding-bottom: var(--cx-space-7);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__node {
  position: absolute;
  top: 6px; left: 85px;
  width: 16px; height: 16px;
  border: 1.5px solid var(--cx-accent);
  background: var(--cx-surface-2);
  transform: rotate(45deg);
}
.timeline__item:first-child .timeline__node { background: var(--cx-accent); }
.timeline__step {
  font-family: var(--cx-font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--cx-accent);
  text-align: right;
}
.timeline__body h3 { font-size: 1.45rem; margin-bottom: var(--cx-space-2); }
.timeline__body p { color: var(--cx-ink-muted); max-width: 62ch; margin-bottom: var(--cx-space-4); }

/* ---------- 12. About ---------------------------------------------------- */

.statement__inner { max-width: 980px; }
.statement__lead {
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.statement .section-copy { font-size: 1.1rem; margin-top: var(--cx-space-6); }

/* ---------- 13. Contact -------------------------------------------------- */

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: var(--cx-space-6) clamp(32px, 5vw, 72px);
  align-items: start;
}
.contact-layout__main > .section-copy { margin-bottom: var(--cx-space-6); }
.contact-aside { position: sticky; top: calc(var(--cx-header-h) + 24px); }
.contact-aside > h2 { margin-bottom: var(--cx-space-5); }
.contact-aside > h3 {
  margin: var(--cx-space-6) 0 var(--cx-space-3);
  font-size: 1rem;
}
.contact-aside__list,
.site-footer__contact { display: grid; gap: var(--cx-space-4); margin: 0; }
.contact-aside__list dt,
.site-footer__contact dt {
  font-family: var(--cx-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cx-ink-muted);
}
.contact-aside__list dd,
.site-footer__contact dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.contact-aside__list a { font-weight: 600; }
.mini-steps {
  list-style: none;
  counter-reset: cx-mini;
  display: grid;
  gap: var(--cx-space-3);
}
.mini-steps li {
  counter-increment: cx-mini;
  position: relative;
  padding-left: 32px;
  color: var(--cx-ink-muted);
  font-size: 0.95rem;
}
.mini-steps li::before {
  content: counter(cx-mini);
  position: absolute;
  left: 0; top: 0.1em;
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border: 1px solid var(--cx-accent);
  border-radius: 50%;
  font-family: var(--cx-font-mono);
  font-size: 0.72rem;
  color: var(--cx-accent);
}

/* ---------- 14. CTA band ------------------------------------------------- */

.cta-band {
  padding-block: clamp(64px, 9vw, 112px);
  overflow: hidden;
  isolation: isolate;
  background-image:
    radial-gradient(50% 80% at 100% 0%, color-mix(in srgb, var(--cx-accent) 18%, transparent), transparent 70%),
    linear-gradient(var(--cx-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--cx-grid) 1px, transparent 1px);
  background-size: auto, 56px 56px, 56px 56px;
}
.cta-band__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) auto;
  align-items: end;
  gap: var(--cx-space-6) var(--cx-space-7);
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--cx-line);
}
.cta-band h2 { max-width: 22ch; }
.cta-band .lede { margin-top: var(--cx-space-4); }
.cta-band .actions { justify-content: flex-end; }
.cta-band__note {
  flex-basis: 100%;
  text-align: right;
  font-family: var(--cx-font-mono);
  font-size: 0.82rem;
  color: var(--cx-ink-muted);
}

/* ---------- 15. Footer --------------------------------------------------- */

.site-footer {
  padding-top: clamp(56px, 7vw, 88px);
  border-top: 1px solid var(--cx-line);
}
.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: var(--cx-space-6);
  padding-bottom: var(--cx-space-7);
}
.site-footer__brand p {
  margin-top: var(--cx-space-4);
  max-width: 40ch;
  color: var(--cx-ink-muted);
  font-size: 0.95rem;
}
.site-footer__heading {
  margin-bottom: var(--cx-space-4);
  font-family: var(--cx-font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cx-accent);
}
.site-footer__col ul { list-style: none; display: grid; gap: var(--cx-space-2); }
.site-footer a { text-decoration: none; }
.site-footer__col a { color: var(--cx-ink-muted); font-size: 0.97rem; }
.site-footer__col a:hover,
.site-footer__contact a:hover { color: var(--cx-accent); }
.site-footer__contact dd { font-size: 0.95rem; }
.site-footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--cx-space-3);
  padding-block: var(--cx-space-5);
  border-top: 1px solid var(--cx-line);
  font-size: 0.85rem;
  color: var(--cx-ink-muted);
}
.site-footer__social { display: flex; gap: var(--cx-space-4); list-style: none; }

/* ---------- 16. 404 ------------------------------------------------------ */

.page-hero--404 { min-height: 62vh; display: flex; align-items: center; }
.page-hero--404 .actions { margin-top: var(--cx-space-6); }
.not-found__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cx-space-3) var(--cx-space-5);
  margin-top: var(--cx-space-7);
  list-style: none;
}

/* ---------- 17. Scroll reveal (main.js adds .is-visible) ---------------- */

@media (prefers-reduced-motion: no-preference) {
  :root.js:not(.no-reveal) [data-reveal]:not(.is-visible) {
    opacity: 0;
    transform: translateY(14px);
  }
  :root.js [data-reveal] {
    transition: opacity 600ms var(--cx-ease), transform 600ms var(--cx-ease);
  }
}

/* ---------- 18. Responsive ---------------------------------------------- */

@media (max-width: 1020px) {
  .card-grid--4,
  .feature-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proof__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proof__item:nth-child(2) { border-right: 1px solid var(--cx-line); }
  .proof__item:nth-child(n + 3) { border-top: 1px solid var(--cx-line); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--cx-space-7); }
  .step:nth-child(2n)::before { display: none; }
  .detail-row { grid-template-columns: 120px minmax(0, 1fr); }
  .detail-row__body { grid-column: 2; }
  .site-footer__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-footer__brand { grid-column: 1 / -1; }
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-card,
  .service-card--featured { grid-column: span 1; min-height: 0; }
}

@media (max-width: 820px) {
  .section-head,
  .split,
  .contact-layout,
  .cta-band__inner { grid-template-columns: minmax(0, 1fr); }
  .section-head { align-items: start; }
  .cta-band .actions { justify-content: flex-start; }
  .cta-band__note { text-align: left; }
  .contact-aside { position: static; }
  .card-grid--3,
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checklist { grid-template-columns: 1fr; }
  .hero::after { background: linear-gradient(180deg, color-mix(in srgb, var(--cx-bg) 55%, transparent), var(--cx-bg) 92%); }
  .page-hero::before, .page-hero::after { width: 70vw; right: -25vw; opacity: 0.35; }
}

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .service-grid,
  .card-grid--3,
  .card-grid--4,
  .feature-grid,
  .feature-grid--4,
  .proof__grid,
  .steps { grid-template-columns: minmax(0, 1fr); }
  .proof__item { border-right: 1px solid var(--cx-line); padding: var(--cx-space-5) var(--cx-space-4); }
  .proof__item + .proof__item { border-top: 1px solid var(--cx-line); }
  .step::before { display: none; }
  .step { padding-top: 0; padding-left: 60px; }
  .page-hero::before, .page-hero::after { display: none; }
  .detail-row { grid-template-columns: minmax(0, 1fr); gap: var(--cx-space-4); }
  .detail-row__index { flex-direction: row; align-items: baseline; gap: var(--cx-space-3); }
  .detail-row__body { grid-column: auto; }
  .timeline::before { left: 7px; }
  .timeline__item { grid-template-columns: minmax(0, 1fr); padding-left: 40px; }
  .timeline__node { left: 0; }
  .timeline__step { text-align: left; font-size: 1rem; margin-bottom: var(--cx-space-2); }
  .site-footer__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .site-footer__contact { grid-column: 1 / -1; }
  .site-footer__grid > .site-footer__col:last-child { grid-column: 1 / -1; }
  .actions .button { flex: 1 1 auto; }
  .meta-list { flex-direction: column; margin-top: var(--cx-space-6); }
  .numbered-list li { grid-template-columns: 40px minmax(0, 1fr); }
}

/* ---------- 19. Motion & print ------------------------------------------ */

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

@media print {
  .site-header, .hero__canvas, .cta-band, .theme-toggle, .nav-toggle { display: none !important; }
  .ink { background: #fff !important; color: #000 !important; }
}
