/* Intelligent Operations — site stylesheet
 *
 * Theming architecture: every colour and font reference is a CSS variable
 * defined per palette + per font pairing. Switch by setting data-palette
 * and/or data-fonts on <body>:
 *
 *   <body data-palette="cream"   data-fonts="geist">       (defaults)
 *   <body data-palette="navy"    data-fonts="modern">
 *   <body data-palette="charcoal" data-fonts="balanced">
 *   <body data-palette="slate"   data-fonts="traditional">
 *
 * Or via URL: ?palette=navy&fonts=modern  (theme.js handles persistence)
 */

/* ============ DEFAULTS: Cream palette + Geist fonts ============ */

:root,
[data-palette="cream"] {
  --bg: #fafaf7;
  --bg-alt: #f3f0e8;
  --paper: #ffffff;
  --ink: #0a0a0a;
  --ink-2: #3a3a3a;
  --muted: #888580;
  --line: #ebe8e0;
  --line-2: #d8d4ca;
  --accent: #2d5a3d;
  --accent-soft: #e8ede4;
  --accent-bright: #3e9b5b;
  --shadow-card: 0 1px 2px rgba(10,10,10,0.04);
  --shadow-lift: 0 4px 12px rgba(0,0,0,0.12);
}

[data-palette="navy"] {
  --bg: #0f1419;
  --bg-alt: #161c24;
  --paper: #1c232c;
  --ink: #f4f1ea;
  --ink-2: #c8cdd3;
  --muted: #8a92a0;
  --line: #2a3340;
  --line-2: #3a4555;
  --accent: #f4a92e;
  --accent-soft: #2a2418;
  --accent-bright: #ffc466;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-lift: 0 4px 12px rgba(0,0,0,0.6);
}

[data-palette="charcoal"] {
  --bg: #161616;
  --bg-alt: #1e1e1e;
  --paper: #262626;
  --ink: #ffffff;
  --ink-2: #cfcfcf;
  --muted: #8a8a8a;
  --line: #2f2f2f;
  --line-2: #424242;
  --accent: #c5ff00;
  --accent-soft: #2a3010;
  --accent-bright: #d4ff33;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.5);
  --shadow-lift: 0 4px 16px rgba(197,255,0,0.12);
}

[data-palette="slate"] {
  --bg: #1e2329;
  --bg-alt: #252b32;
  --paper: #2c333b;
  --ink: #f0eee8;
  --ink-2: #c5c1b8;
  --muted: #8a8478;
  --line: #3a414a;
  --line-2: #4a525c;
  --accent: #b87333;
  --accent-soft: #3a2618;
  --accent-bright: #d18b4a;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-lift: 0 4px 12px rgba(0,0,0,0.5);
}

/* ============ FONT PAIRINGS ============ */

:root,
[data-fonts="geist"] {
  --sans: "Geist", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, Consolas, monospace;
  --display: var(--sans);
  --body: var(--sans);
}

[data-fonts="modern"] {
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --display: "Bricolage Grotesque", "Geist", system-ui, sans-serif;
  --body: "Geist", system-ui, sans-serif;
}

[data-fonts="balanced"] {
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --display: "Fraunces", Georgia, serif;
  --body: "Geist", system-ui, sans-serif;
}

[data-fonts="traditional"] {
  --sans: "IBM Plex Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "IBM Plex Serif", Georgia, serif;
  --body: "IBM Plex Serif", Georgia, serif;
}

/* ============ BASE ============ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img, svg { max-width: 100%; display: block; }

h1, h2, h3, h4, h5, .display { font-family: var(--display); }

/* Layout */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.wrap-narrow { max-width: 880px; margin: 0 auto; padding: 0 32px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  padding: 16px 0;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.scrolled { border-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 22px; letter-spacing: -0.025em; font-family: var(--display); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 16px; font-weight: 600; font-family: var(--display); }
.brand .chip { margin-left: 4px; font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); letter-spacing: 0; font-family: var(--body); }

/* Temporary: hide forge / case-studies / about while pages are being reworked */
.nav-links a[href$="/forge.html"],
.nav-links a[href$="/case-studies.html"],
.nav-links a[href$="/about.html"] { display: none !important; }
.foot-col ul li:has(> a[href$="/forge.html"]),
.foot-col ul li:has(> a[href$="/case-studies.html"]),
.foot-col ul li:has(> a[href$="/about.html"]) { display: none !important; }

.nav-links { display: flex; gap: 2px; align-items: center; font-size: 14px; color: var(--ink-2); }
.nav-links a { padding: 8px 12px; border-radius: 8px; transition: background .12s, color .12s; }
.nav-links a:hover { background: var(--line); }
.nav-links a.active { color: var(--ink); background: var(--line); }
.nav-cta { background: var(--ink) !important; color: var(--bg) !important; padding: 8px 14px !important; border-radius: 8px; font-weight: 500; margin-left: 6px; }
.nav-cta:hover { background: var(--accent) !important; }

.nav-toggle {
  display: none; width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--paper); align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle span { display: block; width: 16px; height: 1.6px; background: var(--ink); position: relative; }
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; right: 0; height: 1.6px; background: var(--ink); }
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute; top: 64px; left: 16px; right: 16px;
    background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
    padding: 10px; flex-direction: column; gap: 2px;
    box-shadow: 0 20px 40px -20px rgba(0,0,0,0.15);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; min-height: 44px; display: flex; align-items: center; }
  .nav-cta { margin-left: 0 !important; text-align: center; justify-content: center; }
  .foot-col ul { gap: 2px; }
  .foot-col a { padding: 12px 0; display: inline-block; line-height: 1.3; }
  .foot-bottom a { padding: 8px 2px; display: inline-block; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: all .15s ease;
  font-family: var(--body);
}
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: 0 1px 2px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.08); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper); border-color: var(--line-2); }
.btn-text { color: var(--ink-2); padding: 11px 4px; font-size: 14px; }
.btn-text:hover { color: var(--ink); }
.btn .arr { transition: transform .15s ease; }
.btn:hover .arr { transform: translateX(3px); }

/* Chip label — used as section eyebrow throughout the site.
   Bumped to be properly visible (was getting lost). */
.chip-label {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line-2);
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  letter-spacing: 0;
  font-family: var(--body);
}
.chip-label::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}

/* Status pill */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2);
  box-shadow: var(--shadow-card);
  white-space: nowrap;
  font-family: var(--body);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-bright); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent-bright) 25%, transparent); }
.pill b { color: var(--ink); font-weight: 500; }

/* Section titles */
.section-title {
  font-size: clamp(28px, 3.4vw, 40px); font-weight: 600;
  letter-spacing: -0.025em; line-height: 1.1;
  margin: 14px 0 0; max-width: 24ch;
  text-wrap: balance;
  font-family: var(--display);
}
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 32px; margin-bottom: 36px; flex-wrap: wrap; }
.sec-sub { font-size: 15px; color: var(--ink-2); margin: 10px 0 0; max-width: 42ch; }

section { padding: 72px 0; }
@media (max-width: 820px) { section { padding: 56px 0; } }

.tag { font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-family: var(--body); }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px;
}

.not-for {
  padding: 16px 18px; background: var(--bg-alt);
  border-radius: 10px; border: 1px solid var(--line);
  font-size: 14px; color: var(--ink-2); line-height: 1.55;
}
.not-for b { display: block; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 4px; letter-spacing: -0.005em; }

.commercials {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.commercials > div { padding: 18px 22px; border-right: 1px solid var(--line); }
.commercials > div:last-child { border-right: none; }
.commercials .k { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.commercials .v { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; font-family: var(--display); }
.commercials .v small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 4px; letter-spacing: 0; font-family: var(--body); }
@media (max-width: 700px) {
  .commercials { grid-template-columns: 1fr; }
  .commercials > div { border-right: none; border-bottom: 1px solid var(--line); }
  .commercials > div:last-child { border-bottom: none; }
}

.faq-list { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.faq-list details { padding: 20px 24px; border-top: 1px solid var(--line); cursor: pointer; }
.faq-list details:first-of-type { border-top: none; }
.faq-list summary {
  font-size: 15.5px; font-weight: 500; letter-spacing: -0.01em;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 20px;
  font-family: var(--display);
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+"; font-family: var(--mono); font-weight: 400;
  color: var(--muted); font-size: 18px; transition: transform .2s ease;
  width: 22px; height: 22px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); flex-shrink: 0;
}
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details p { margin: 12px 0 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.6; max-width: 62ch; }

.cta-block {
  margin: 0;
  background: var(--ink); color: var(--bg);
  border-radius: 18px; padding: 56px 48px;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: end;
  position: relative; overflow: hidden;
}
@media (max-width: 820px) { .cta-block { grid-template-columns: 1fr; padding: 40px 28px; } }
.cta-block::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 85% 120%, color-mix(in oklab, var(--accent-bright) 28%, transparent), transparent 50%),
    radial-gradient(circle at 0% -20%, rgba(255,255,255,0.04), transparent 40%);
  pointer-events: none;
}
.cta-block > * { position: relative; }
.cta-block .chip-dark {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.85);
  font-size: 12px; font-weight: 500; font-family: var(--body);
}
.cta-block .chip-dark::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-bright); }
.cta-block h2 { font-size: clamp(28px, 3.6vw, 44px); font-weight: 600; letter-spacing: -0.025em; margin: 16px 0 0; line-height: 1.05; max-width: 16ch; font-family: var(--display); }
.cta-block p { color: rgba(255,255,255,0.65); margin: 14px 0 0; font-size: 15px; max-width: 46ch; }
.cta-block .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cta-block .btn-primary { background: var(--bg); color: var(--ink); }
.cta-block .btn-primary:hover { background: var(--paper); }
.cta-block .btn-ghost { background: transparent; border-color: rgba(255,255,255,0.2); color: var(--bg); }
.cta-block .btn-ghost:hover { background: rgba(255,255,255,0.06); }

footer {
  border-top: 1px solid var(--line); padding: 48px 0 56px;
  margin-top: 56px;
  font-size: 14px; color: var(--ink-2);
}
.foot-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px;
  padding-bottom: 40px; border-bottom: 1px solid var(--line);
}
@media (max-width: 820px) { .foot-grid { grid-template-columns: 1fr 1fr; gap: 28px; } }
.foot-col h4 { font-size: 12px; letter-spacing: -0.005em; color: var(--muted); margin: 0 0 14px; font-weight: 500; text-transform: none; font-family: var(--body); }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot-col a { color: var(--ink-2); }
.foot-col a:hover { color: var(--ink); }
.foot-col p { margin: 0; color: var(--ink-2); font-size: 13.5px; opacity: 0.85; }
.foot-bottom {
  padding-top: 20px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn-primary:hover, .btn:hover { transform: none; }
}

/* Theme picker — always visible bottom-right; tap to expand on mobile */
.theme-switcher {
  position: fixed; bottom: 16px; right: 16px; z-index: 100;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  font-size: 11.5px; font-family: var(--mono); color: var(--ink-2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.04);
  overflow: hidden;
  transition: all .18s ease;
}
.theme-switcher .ts-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.theme-switcher .ts-toggle::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 1px solid var(--line-2);
}
.theme-switcher .ts-toggle b { color: var(--ink); font-weight: 500; letter-spacing: -0.005em; }
.theme-switcher .ts-toggle .caret {
  margin-left: 6px; color: var(--muted); font-size: 10px; transition: transform .15s ease;
}
.theme-switcher.open .ts-toggle .caret { transform: rotate(180deg); }
.theme-switcher .ts-body {
  display: none; padding: 6px 12px 12px;
  flex-direction: column; gap: 8px; min-width: 180px;
  border-top: 1px solid var(--line);
}
.theme-switcher.open .ts-body { display: flex; }
.theme-switcher label {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--muted); text-transform: lowercase;
}
.theme-switcher select {
  font: inherit; font-size: 12px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px;
  cursor: pointer;
}
.theme-switcher select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 480px) {
  .theme-switcher { bottom: 12px; right: 12px; font-size: 11px; }
  .theme-switcher .ts-body { min-width: 160px; }
}
