/* =============================================================================
   ConfluxLab — stylesheet
   Tokens, type scale, grid, and components follow brand/03-visual-system.md.
   Sans-only system; two accents are semantic (teal = quantitative/finance,
   amber = humanitarian), never decorative.
   ========================================================================== */

/* ---- Fonts (self-hosted, no external requests) --------------------------- */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-300.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400.woff2') format('woff2');
}

/* ---- Tokens -------------------------------------------------------------- */
:root {
  --ink: #0E1116;
  --paper: #F5F6F7;
  --surface: #FFFFFF;
  --line: #E5E7EB;
  --mute: #6B7280;
  --teal: #1F7A8C;
  --amber: #C45A3A;

  --font-sans: 'IBM Plex Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --measure: 72ch;
  --reading: 720px;
  --maxw: 1280px;
  --gutter: 24px;
  --radius: 6px;

  /* Vertical rhythm: section spacing ~2x heading line-height */
  --space-section: clamp(3.5rem, 8vw, 6.5rem);
}

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 3px; }

/* ---- Type scale (1.250 major third, 16px base) --------------------------- */
h1, h2, h3, h4 { font-weight: 500; line-height: 1.18; margin: 0 0 0.5em; letter-spacing: -0.01em; }
.display { font-size: clamp(2.25rem, 5.5vw, 3.5rem); line-height: 1.08; font-weight: 500; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.75rem); }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
p { margin: 0 0 1.15em; }
strong { font-weight: 600; }

.eyebrow {
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--mute);
  margin: 0 0 1rem;
}
.lede { font-size: 1.1875rem; color: var(--ink); max-width: var(--measure); }
.mono { font-family: var(--font-mono); font-size: 0.8125rem; }
.muted { color: var(--mute); }

/* ---- Layout -------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--space-section); }
.section + .section { border-top: 1px solid var(--line); }
/* Long-form reading column — centred with balanced margins (case-study
   articles). Text inside stays left-aligned. */
.reading { max-width: var(--reading); }
.reading p, .reading li { max-width: var(--measure); }

/* Editorial two-column layout for prose sections on the home page: a heading
   rail on the left, body to the right. Fills the page width so a section reads
   as a web page rather than a single book column, while staying left-aligned. */
.editorial { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 1.5rem 4.5rem; align-items: start; }
.editorial .col-head { max-width: 30ch; }
.editorial .col-head .eyebrow { margin-bottom: 0.75rem; }
.editorial .col-head h2 { margin: 0; }
.editorial .col-head .lede { margin-top: 1rem; font-size: 1.0625rem; }
.editorial .col-body { max-width: var(--reading); }
.editorial .col-body > * { max-width: var(--measure); }
@media (max-width: 900px) {
  .editorial { grid-template-columns: 1fr; gap: 1rem; }
  .editorial .col-head { max-width: var(--measure); }
}
.stack > * + * { margin-top: 1.5rem; }

/* ---- Skip link ----------------------------------------------------------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.75rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---- Header / nav -------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; }
.brand .mark { height: 30px; width: auto; flex: none; }
.brand .wordmark { font-family: var(--font-sans); font-size: 1.4rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1; color: var(--ink); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1.75rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--ink); font-size: 0.9375rem; }
.nav-links a:hover { color: var(--teal); text-decoration: none; }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius);
  width: 42px; height: 42px; cursor: pointer; color: var(--ink); padding: 0;
}
.nav-toggle svg { width: 22px; height: 22px; margin: auto; stroke: currentColor; }

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1rem;
    max-height: 0; overflow: hidden; visibility: hidden;
    transition: max-height 0.25s ease, visibility 0.25s;
  }
  .nav-links.open { max-height: 24rem; visibility: visible; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; width: 100%; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.9375rem; font-weight: 500; line-height: 1;
  padding: 0.75rem 1.15rem; border-radius: var(--radius);
  border: 1px solid var(--ink); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #000; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---- Hero ---------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(4rem, 10vw, 8rem); text-align: center; }
.hero .container { position: relative; z-index: 1; }
.hero .display { margin-inline: auto; max-width: 18ch; }
.hero .subhead { font-size: 1.1875rem; color: var(--ink); max-width: 60ch; margin: 1.5rem auto 2rem; }
.hero .btn-row { justify-content: center; }
/* River motif: two currents meeting at a node, behind the hero. Kept as a
   faint watermark so it never competes with the headline for legibility. */
.river {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; opacity: 0.18; pointer-events: none;
}
.river .stream-teal { stroke: var(--teal); }
.river .stream-amber { stroke: var(--amber); }
.river .stream-tail { stroke: var(--ink); }
.river .node { fill: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .river .draw { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.4s ease forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- Cards / grids ------------------------------------------------------- */
.grid { display: grid; gap: var(--gutter); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem; display: flex; flex-direction: column;
}
.card h3 { margin-top: 0.75rem; }
.card .card-link { margin-top: auto; padding-top: 1rem; font-weight: 500; }

/* Pillar tag — semantic accent strip */
.tag {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--mute);
}
.tag::before { content: ""; width: 1.5rem; height: 3px; border-radius: 2px; background: var(--mute); }
.tag.teal::before { background: var(--teal); }
.tag.amber::before { background: var(--amber); }
.tag.dual::before { background: linear-gradient(90deg, var(--teal) 0 50%, var(--amber) 50% 100%); }

/* ---- Case-study preview cards ------------------------------------------- */
.case-card { position: relative; }
.case-card:hover { border-color: var(--ink); }
.chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.02em;
  padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--mute); background: var(--paper); align-self: flex-start; margin-bottom: 1rem;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }

/* ---- "How we work" list -------------------------------------------------- */
.principles { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
.principles li { padding-left: 1.25rem; border-left: 2px solid var(--line); }
.principles li strong { display: inline; }

/* ---- Definition / contact ------------------------------------------------ */
.contact-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.6rem; }
.contact-list dt { font-weight: 500; }
.contact-grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; align-items: baseline; }
.contact-grid dt { color: var(--mute); }
.contact-grid a { font-family: var(--font-mono); font-size: 0.9375rem; }
/* Email buttons: rendered as links, but the address is assembled in JS on a
   trusted click — no plain-text mailto in the markup for scrapers to harvest. */
.email-btn {
  font-family: var(--font-mono); font-size: 0.9375rem;
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--teal); cursor: pointer; text-align: left;
}
.email-btn:hover .email-obf { text-decoration: underline; text-underline-offset: 3px; }
.email-obf { white-space: nowrap; }
@media (max-width: 540px) { .contact-grid { grid-template-columns: 1fr; gap: 0.1rem 0; } .contact-grid dd { margin: 0 0 0.6rem; } }

/* ---- Figures ------------------------------------------------------------- */
figure { margin: 2rem 0; }
figure.bordered { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; background: var(--surface); }
figcaption {
  font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.5;
  color: var(--mute); margin-top: 0.75rem;
}
figcaption .num { color: var(--ink); }

/* Stat row */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gutter); margin: 2rem 0; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr; } }
.stat { border-top: 2px solid var(--line); padding-top: 0.75rem; }
.stat.teal { border-color: var(--teal); }
.stat.amber { border-color: var(--amber); }
.stat .num { font-size: 1.75rem; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .label { font-size: 0.875rem; color: var(--mute); margin-top: 0.35rem; }

/* ---- Blockquote (partner quotes) ---------------------------------------- */
blockquote {
  margin: 2rem 0; padding: 0 0 0 1.5rem; border-left: 3px solid var(--amber);
  font-weight: 300; font-style: italic; font-size: 1.1875rem; color: var(--ink);
}
blockquote cite { display: block; font-size: 0.9375rem; font-style: normal; color: var(--mute); margin-top: 0.75rem; }

/* ---- Case article layout ------------------------------------------------- */
/* Inherits the home page's editorial composition: a title/meta rail on the
   left, the article body on the right — so case studies read like the rest of
   the site rather than a single centred column. */
.case-article { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.case-layout { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 2.5rem 4.5rem; align-items: start; }
.case-aside { position: sticky; top: 88px; }
.case-aside .tag { margin-top: 0.85rem; }
.case-aside h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); line-height: 1.18; margin: 1rem 0 0; }
.case-aside .meta { margin-top: 1rem; }
.case-main { max-width: var(--reading); }
.case-main > .lede { margin-bottom: 2.5rem; }
@media (max-width: 980px) {
  .case-layout { grid-template-columns: 1fr; gap: 1.25rem; }
  .case-aside { position: static; }
  .case-main > .lede { margin-bottom: 1.5rem; }
}
.case-hero { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem); }
.breadcrumb { font-size: 0.875rem; color: var(--mute); margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--mute); }
.breadcrumb a:hover { color: var(--teal); }
.case-body h2 { margin-top: 2.75rem; }
.case-body h3 { margin-top: 1.75rem; }
.case-body ul, .case-body ol { padding-left: 1.25rem; }
.case-body li { margin-bottom: 0.5rem; max-width: var(--measure); }
.callout {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--teal);
  border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 2rem 0;
}
.callout.amber { border-left-color: var(--amber); }
.callout p:last-child { margin-bottom: 0; }

/* ---- Radar chart (Allot) ------------------------------------------------- */
.radar-wrap { display: grid; grid-template-columns: 1fr; gap: 1rem; place-items: center; }
.radar-wrap svg { width: 100%; max-width: 460px; height: auto; }
.radar .grid-line { stroke: var(--line); fill: none; }
.radar .axis-line { stroke: var(--line); }
.radar .area { fill: color-mix(in srgb, var(--amber) 18%, transparent); stroke: var(--amber); stroke-width: 2; }
.radar .point { fill: var(--amber); }
.radar .axis-label { font-family: var(--font-sans); font-size: 11px; fill: var(--mute); }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { background: var(--ink); color: var(--paper); padding-block: 3.5rem 2rem; }
.site-footer a { color: var(--paper); }
.site-footer a:hover { color: #fff; }
.footer-top { display: grid; grid-template-columns: 1.7fr 1fr 1fr; gap: var(--gutter); }
@media (max-width: 820px) { .footer-top { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-top { grid-template-columns: 1fr; } }
.footer-social { display: inline-block; margin-top: 1rem; font-size: 0.9375rem; }
.site-footer .brand .mark { height: 28px; }
.site-footer .brand .wordmark { color: var(--paper); }
.footer-col h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: #9aa1ab; font-weight: 500; margin-bottom: 1rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.footer-col a { font-size: 0.9375rem; }
.footer-tagline { color: #c3c8cf; font-size: 0.9375rem; margin-top: 1rem; max-width: 34ch; }
.footer-bottom { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid #2a2f37; display: grid; gap: 0.75rem; }
.footer-bottom p { font-size: 0.8125rem; color: #9aa1ab; margin: 0; }
.footer-disclaimer { font-size: 0.75rem; color: #6f7782; }

/* ---- Utilities ----------------------------------------------------------- */
.center { text-align: center; }
.section-head { max-width: var(--measure); margin-bottom: 2.5rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
