/* ==========================================================================
   Cogneta Automation - cogneta.io
   Single stylesheet. Design tokens first, then base, sections, components.
   Brand: ink navy / warm paper / amber (deck brand system, July 2026).
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --ink: #0F1E2E;
  --ink-2: #16293C;          /* raised surface on dark */
  --paper: #FAF8F4;
  --paper-2: #F2EDE4;        /* tinted section on light */
  --amber: #C96F20;          /* accent on light (AA on paper) */
  --amber-bright: #E89B4B;   /* accent on dark */
  --ink-70: rgba(15, 30, 46, 0.74);
  --paper-70: rgba(250, 248, 244, 0.78);
  --line-light: rgba(15, 30, 46, 0.16);
  --line-dark: rgba(250, 248, 244, 0.2);

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;

  --max-w: 1120px;
  --radius: 10px;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 40px; --s5: 64px; --s6: 96px;

  /* Default theme vars so components also resolve outside .section scopes
     (header, footer, stray content). Sections remap these locally. */
  --bg: var(--paper); --fg: var(--ink); --muted: var(--ink-70);
  --accent: var(--amber); --line: var(--line-light); --surface: #FFFFFF;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 var(--s2); }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); font-weight: 300; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 300; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 var(--s2); }
:focus-visible { outline: 3px solid var(--amber-bright); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Section theming ----------
   Components read the local vars; sections remap them. */
.section {
  background: var(--bg); color: var(--fg);
  padding: var(--s6) 0;
}
.section--dark, .site-footer {
  --bg: var(--ink); --fg: var(--paper); --muted: var(--paper-70);
  --accent: var(--amber-bright); --line: var(--line-dark); --surface: var(--ink-2);
}
.section--tint { --bg: var(--paper-2); --surface: #FFFFFF; }
.section--light {
  --bg: var(--paper); --fg: var(--ink); --muted: var(--ink-70);
  --accent: var(--amber); --line: var(--line-light); --surface: #FFFFFF;
}
.section--slim { padding: var(--s5) 0; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--s3); }
.grid-2 { display: grid; gap: var(--s3); }
.grid-3 { display: grid; gap: var(--s3); }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.eyebrow {
  display: block;
  font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--s2);
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 46em; }
.muted { color: var(--muted); }
.section-head { max-width: 52em; margin-bottom: var(--s4); }

/* Mono chips: instrument-tag styling for stats and stacks */
.chip {
  display: inline-block;
  font-family: var(--mono); font-size: 0.8rem;
  padding: 3px 10px; border: 1px solid var(--line); border-radius: 4px;
  color: var(--muted); white-space: nowrap;
}
.chip--accent { color: var(--accent); border-color: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--s1); margin: var(--s2) 0 0; padding: 0; list-style: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-weight: 600; font-size: 1rem; text-decoration: none;
  padding: 12px 26px; border-radius: 6px;
  border: 2px solid var(--accent);
  background: var(--accent); color: var(--ink);
  transition: transform 120ms ease, background 120ms ease;
}
.btn:hover { transform: translateY(-1px); }
/* Outline variant: transparent fill, section foreground for text.
   Kept after .btn and never overridden by section-scoped rules. */
.btn--outline { background: transparent; color: var(--fg); }
.btn--outline:hover { background: var(--accent); color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line-light);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.02rem; letter-spacing: 0.18em;
  text-decoration: none; color: var(--ink);
}
.brand-mark {
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--amber); flex: none;
}
.site-nav { display: flex; align-items: center; gap: var(--s3); }
.site-nav a {
  text-decoration: none; font-size: 0.98rem; color: var(--ink-70);
  padding: 6px 2px; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] {
  color: var(--ink); font-weight: 600;
  border-bottom-color: var(--amber);
}
.site-nav .btn { padding: 8px 18px; font-size: 0.95rem; color: var(--ink); }
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--line-light); border-radius: 6px;
  padding: 8px 10px; cursor: pointer; color: var(--ink);
}
.nav-toggle svg { display: block; }
@media (max-width: 719px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line-light);
    padding: var(--s2) var(--s3) var(--s3);
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 4px; border-bottom: 1px solid var(--line-light); }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--amber); }
  .site-nav .btn { margin-top: var(--s2); text-align: center; }
}

/* ---------- Hero ---------- */
.hero { padding: var(--s6) 0; }
.hero .container {
  display: grid; gap: var(--s4); align-items: center;
}
@media (min-width: 900px) {
  .hero .container { grid-template-columns: 11fr 9fr; }
}
.hero h1 strong { font-weight: 600; }
.hero-art { color: var(--paper-70); }
.hero-art svg { width: 100%; height: auto; }

/* Animated flow line inside the hero schematic */
.flow-line {
  stroke-dasharray: 6 8;
  animation: flow 2.6s linear infinite;
}
@keyframes flow { to { stroke-dashoffset: -28; } }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s3);
}
.card h3 { margin-top: var(--s2); }
.card .icon { color: var(--accent); }
.card-link { text-decoration: none; display: block; }
.card-link:hover { border-color: var(--accent); }
.card-link .more { color: var(--accent); font-weight: 600; font-size: 0.95rem; }

/* Stat blocks (dark proof band) */
.stat { border-left: 2px solid var(--accent); padding-left: var(--s2); }
.stat .num {
  font-family: var(--mono); font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 400; color: var(--fg); line-height: 1.1; display: block;
}
.stat .label { color: var(--muted); font-size: 0.98rem; }
.stats-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

/* Client-name strip */
.names-strip {
  display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3);
  margin: var(--s3) 0 0; padding: var(--s3) 0 0; list-style: none;
  border-top: 1px solid var(--line);
}
.names-strip li {
  font-size: 0.95rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}

/* ---------- Case studies ---------- */
.case {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s4);
  margin-bottom: var(--s4);
  display: grid; gap: var(--s3);
}
@media (min-width: 900px) {
  .case { grid-template-columns: 7fr 3fr; align-items: start; }
}
.case h2 { font-size: 1.5rem; font-weight: 600; }
.case dl { margin: 0; }
.case dt {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin-top: var(--s2);
}
.case dd { margin: 4px 0 0; color: var(--muted); }
.case-side { color: var(--ink-70); }
.case-side svg { width: 100%; max-width: 260px; height: auto; color: var(--ink-70); }

/* ---------- Founder / about ---------- */
.founder { display: grid; gap: var(--s4); align-items: start; }
@media (min-width: 900px) { .founder { grid-template-columns: 320px 1fr; } }
.portrait {
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.cred-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s2); }
@media (min-width: 720px) { .cred-list { grid-template-columns: 1fr 1fr; } }
.cred-list li {
  border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 16px; background: var(--surface);
}

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: var(--s2); }
label { font-weight: 600; font-size: 0.95rem; display: block; margin-bottom: 6px; }
input, textarea {
  width: 100%;
  font: inherit; color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--line-light); border-radius: 6px;
  padding: 11px 14px;
}
input:focus, textarea:focus { border-color: var(--amber); outline: none; box-shadow: 0 0 0 3px rgba(217, 123, 41, 0.18); }
textarea { min-height: 140px; resize: vertical; }
.contact-detail { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s2); }
.contact-detail a { color: var(--amber); font-weight: 600; text-decoration: none; }
.contact-detail a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer {
  --bg: var(--ink); --fg: var(--paper); --muted: var(--paper-70);
  --accent: var(--amber-bright); --line: var(--line-dark);
  background: var(--bg); color: var(--fg);
  padding: var(--s5) 0 var(--s4);
  font-size: 0.98rem;
}
.site-footer .brand { color: var(--paper); }
.site-footer .brand-mark { background: var(--amber-bright); }
.footer-grid { display: grid; gap: var(--s4); }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 {
  font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--amber-bright); margin-bottom: var(--s2);
}
.site-footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.site-footer a { color: var(--paper-70); text-decoration: none; }
.site-footer a:hover { color: var(--paper); }
.footer-bottom {
  margin-top: var(--s4); padding-top: var(--s3);
  border-top: 1px solid var(--line-dark);
  color: var(--paper-70); font-size: 0.9rem;
  display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: space-between;
}

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 500ms ease, transform 500ms ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .flow-line { animation: none; }
  .btn { transition: none; }
}
