/* ===========================================================================
   CAI Systems — design system.
   ===========================================================================

   PALETTE PROVENANCE
   ------------------
   Not invented. Sampled from the two references the brief named, by
   downloading their Awwwards thumbnails and counting quantised pixels
   (tools used once, in scratch — the numbers below are the output):

     MyChess.Events   #000000 ground (26%), #F0F0DC cream (22%),
                      #001428 deep navy, #C88C3C gold accent
     Bebit            #D8D8C0 bone (58%), #003060 navy, #004830 forest,
                      #F0D878 mustard
     mount inc.       #181818 near-black (48%), #0048D8 cobalt (37%)

   Both references independently land on the same executive triad —
   near-black ground, warm cream, gold accent — so that is what this is.
   Navy, forest and cobalt come in as supporting roles.

   CONTRAST
   --------
   --gold (#C9972F) reaches 7.6:1 on --ink but only 2.4:1 on --cream, so it
   MUST NOT be used for text on a light ground. --gold-ink (#8A6412) is the
   light-ground variant at 4.8:1. This distinction is the single easiest
   thing to get wrong here; tools/check-contrast.js enforces it.

   This file is shared by the CAI Systems pages only (index.html,
   about.html). The Prospectus product pages keep shared/tokens.css — two
   brands, two visual registers, deliberately. */

:root {
  /* --- grounds --- */
  --ink:        #07090E;   /* near-black, MyChess #000000/#000014 */
  --ink-2:      #0D131F;   /* raised dark surface */
  --ink-3:      #141C2C;   /* card on dark */
  --navy:       #0E2440;   /* MyChess #001428 / Bebit #003060 */
  --cream:      #F7F3E6;   /* MyChess #F0F0DC / Bebit #D8D8C0 */
  --cream-2:    #EFE9D8;
  --cream-3:    #E4DCC5;

  /* --- type --- */
  --on-ink:     #F6F4EE;
  --on-ink-2:   #B4B8C2;
  --on-ink-3:   #868D9C;
  --on-cream:   #0B0F16;
  --on-cream-2: #414B5A;
  --on-cream-3: #68717F;

  /* --- accent --- */
  --gold:       #C9972F;   /* MyChess #C88C3C. DARK GROUNDS ONLY. */
  --gold-bright:#E2BC6A;
  --gold-ink:   #8A6412;   /* the light-ground variant — 4.8:1 on cream */
  --gold-faint: rgba(201,151,47,0.14);

  --steel:      #1E4D7B;   /* MyChess photo #143C64 */
  --forest:     #0F5132;   /* Bebit #004830 */
  --clay:       #C2562F;   /* St. Martin warm */

  --line-dark:  rgba(246,244,238,0.12);
  --line-dark-2:rgba(246,244,238,0.22);
  --line-light: rgba(11,15,22,0.12);
  --line-light-2:rgba(11,15,22,0.22);

  --font-display: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --shadow-lift: 0 2px 4px rgba(0,0,0,0.22), 0 24px 48px -20px rgba(0,0,0,0.55);
  --radius: 14px;
  --radius-lg: 22px;
  --wrap: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--ink);
  color: var(--on-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
@media (max-width: 760px) { .wrap { padding: 0 18px; } }

/* --------------------------------------------------------------- type --- */
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.028em;
  line-height: 1.04;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 6.4vw, 4.5rem); }
h2 { font-size: clamp(1.9rem, 4.2vw, 3rem); letter-spacing: -0.026em; }
h3 { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.014em; line-height: 1.25; }
p  { margin: 0 0 1rem; }
a  { color: inherit; }

/* The uppercase gold rule above a heading — MyChess uses this above every
   section statement, and it is most of what makes the page read as
   executive rather than startup. */
.eyebrow {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.17em;
  color: var(--gold); margin: 0 0 20px;
}
.eyebrow::before {
  content: ""; width: 28px; height: 2px; background: var(--gold); flex-shrink: 0;
}
.on-cream .eyebrow { color: var(--gold-ink); }
.on-cream .eyebrow::before { background: var(--gold-ink); }
.eyebrow.centred { justify-content: center; }

.lede { font-size: 1.12rem; line-height: 1.62; color: var(--on-ink-2); max-width: 58ch; }
.on-cream .lede { color: var(--on-cream-2); }
.lede strong { color: var(--on-ink); font-weight: 600; }
.on-cream .lede strong { color: var(--on-cream); }

/* --------------------------------------------------------------- bars --- */
/* Thin utility strip above the nav — straight from the reference. */
.utility {
  background: #000; color: var(--on-ink-3);
  font-size: 0.76rem; letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.utility-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 8px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.utility a { color: var(--on-ink-3); text-decoration: none; }
.utility a:hover { color: var(--gold-bright); }
.utility .right { display: flex; gap: 20px; align-items: center; }
@media (max-width: 760px) {
  .utility-inner { padding: 7px 18px; font-size: 0.71rem; }
  /* Hides the tagline and the secondary link — at 375px the full string
     wrapped onto a second line and doubled the bar's height. */
  .utility .hide-sm { display: none; }
}

.nav { background: var(--ink); border-bottom: 1px solid var(--line-dark); position: relative; z-index: 20; }
.nav-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 16px 28px;
  display: flex; align-items: center; gap: 28px;
}
.brand {
  display: inline-flex; align-items: center; gap: 11px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.06rem;
  letter-spacing: -0.02em; color: var(--on-ink); text-decoration: none; flex-shrink: 0;
}
.brand .mark {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  background: var(--gold); color: #000;
  display: grid; place-items: center; font-size: 0.86rem; font-weight: 800;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a {
  font-size: 0.875rem; font-weight: 500; color: var(--on-ink-2);
  text-decoration: none; padding: 8px 13px; border-radius: 7px; white-space: nowrap;
}
.nav-links a:hover { color: var(--on-ink); background: rgba(255,255,255,0.06); }
.nav-links a.current { color: var(--gold-bright); }
/* Brand + six links + the CTA measure ~1040px at full size, so at a 1024
   laptop — a very common width — the button overflowed the viewport and gave
   the whole PAGE a horizontal scrollbar.
   Two stages rather than one. Tightening the links keeps the nav on a single
   line down to ~900px, which looks right on a laptop; only below that does it
   wrap. The `order` properties matter: without them `.nav-links { width:100% }`
   pushes the button onto a THIRD row, leaving a 165px-tall nav. */
@media (max-width: 1100px) {
  .nav-inner { gap: 18px; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 8px 9px; font-size: 0.82rem; }
  .nav .btn { padding: 11px 16px; font-size: 0.76rem; }
}
@media (max-width: 900px) {
  .nav-inner { padding: 13px 18px; gap: 12px 14px; flex-wrap: wrap; }
  .brand { order: 1; }
  .nav .btn { order: 2; margin-left: auto; }
  .nav-links {
    order: 3; margin-left: 0; width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 7px 10px; }
}

/* ------------------------------------------------------------ buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-display); font-weight: 700; font-size: 0.83rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 14px 24px; border-radius: 8px; border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-gold { background: var(--gold); color: #0A0700; }
.btn-gold:hover { background: var(--gold-bright); }
.btn-ghost-dark { border-color: var(--line-dark-2); color: var(--on-ink); background: transparent; }
.btn-ghost-dark:hover { background: rgba(255,255,255,0.07); border-color: var(--on-ink-3); }
.btn-ghost-light { border-color: var(--line-light-2); color: var(--on-cream); background: transparent; }
.btn-ghost-light:hover { background: rgba(11,15,22,0.05); }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-ink:hover { background: var(--navy); }
.btn-sm { padding: 10px 17px; font-size: 0.76rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}

/* ----------------------------------------------------------- sections --- */
.band { padding: 92px 0; }
.band-sm { padding: 64px 0; }
.on-ink { background: var(--ink); color: var(--on-ink); }
.on-ink-2 { background: var(--ink-2); color: var(--on-ink); }
.on-navy { background: var(--navy); color: var(--on-ink); }
.on-cream { background: var(--cream); color: var(--on-cream); }
.on-cream h1, .on-cream h2, .on-cream h3 { color: var(--on-cream); }
@media (max-width: 760px) { .band { padding: 60px 0; } .band-sm { padding: 44px 0; } }

.section-head { max-width: 64ch; margin-bottom: 44px; }
.section-head.centred { margin-left: auto; margin-right: auto; text-align: center; }
.section-head.centred .lede { margin-left: auto; margin-right: auto; }
.section-head h2 + .lede { margin-top: 18px; }

/* ------------------------------------------------------------- cards --- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 950px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--ink-3); border: 1px solid var(--line-dark);
  border-radius: var(--radius); padding: 26px;
}
.card p { color: var(--on-ink-2); font-size: 0.93rem; margin: 0; }
.on-cream .card { background: #FFF; border-color: var(--line-light); }
.on-cream .card p { color: var(--on-cream-2); }

.card-num {
  font-family: var(--font-display); font-size: 0.74rem; font-weight: 800;
  letter-spacing: 0.1em; color: var(--gold); margin-bottom: 14px; display: block;
}
.on-cream .card-num { color: var(--gold-ink); }

/* ------------------------------------------------------------ footer --- */
footer.site { background: #000; padding: 56px 0 44px; border-top: 1px solid var(--line-dark); }
footer.site a { color: var(--on-ink-2); text-decoration: none; font-size: 0.88rem; }
footer.site a:hover { color: var(--gold-bright); }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; margin-bottom: 36px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; gap: 26px; } }
.foot-col h4 {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--on-ink-3); margin: 0 0 14px; font-weight: 700;
}
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.foot-bottom {
  border-top: 1px solid var(--line-dark); padding-top: 24px;
  font-size: 0.8rem; color: var(--on-ink-3);
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between;
}

/* --------------------------------------------------------- diagram --- */
.diagram { width: 100%; height: auto; display: block; }
.dg-l   { font: 600 11.5px var(--font-body); fill: var(--on-ink-2); }
.dg-s   { font: 500 9.5px var(--font-body); fill: var(--on-ink-3); }
.dg-box { fill: var(--ink-3); stroke: var(--line-dark-2); }
.dg-gold{ fill: rgba(201,151,47,0.13); stroke: var(--gold); }
.dg-e   { stroke: var(--line-dark-2); stroke-width: 1.5; fill: none; }
.dg-eg  { stroke: var(--gold); stroke-width: 1.8; fill: none; }
.on-cream .dg-l { fill: var(--on-cream-2); }
.on-cream .dg-s { fill: var(--on-cream-3); }
.on-cream .dg-box { fill: #FFF; stroke: var(--line-light-2); }
.on-cream .dg-gold { fill: rgba(201,151,47,0.16); stroke: var(--gold-ink); }
.on-cream .dg-e { stroke: var(--line-light-2); }
.on-cream .dg-eg { stroke: var(--gold-ink); }

.pulse {
  stroke: var(--gold-bright); stroke-width: 2.4; fill: none; stroke-linecap: round;
  stroke-dasharray: 18 190; animation: flow 3.4s linear infinite;
}
.pulse.d1 { animation-delay: .6s; } .pulse.d2 { animation-delay: 1.2s; } .pulse.d3 { animation-delay: 1.9s; }
@keyframes flow { from { stroke-dashoffset: 208; } to { stroke-dashoffset: 0; } }
.twinkle { animation: tw 3.6s ease-in-out infinite; }
.twinkle.b { animation-delay: 1.2s; } .twinkle.c { animation-delay: 2.3s; }
@keyframes tw { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .pulse, .twinkle { animation: none; }
  .pulse { stroke-dasharray: none; opacity: .45; }
  .btn { transition: none; }
}
