/* =============================================
   Managed Intelligence Labs — Design System
   styles.css
   ============================================= */

:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Ink (light-surface text & borders) */
  --ink-900: #0F172A;
  --ink-700: #1E293B;
  --ink-600: #374151;
  --ink-500: #475569;
  --ink-400: #94A3B8;
  --ink-200: #E2E8F0;
  --ink-100: #F1F5F9;
  --ink-50:  #F8FAFC;

  /* Dark-surface palette */
  --dark:        #0B1118;
  --dark-alt:    #111827;
  --dark-text:   #E2E8F0;
  --dark-muted:  rgba(226, 232, 240, 0.65);
  --dark-border: rgba(255, 255, 255, 0.09);

  /* Brand */
  --accent:       #2f5daa;
  --accent-dark:  #264e90;
  --accent-light: rgba(47, 93, 170, 0.08);

  /* White */
  --white: #FFFFFF;

  /* Layout */
  --max-w:        1200px;
  --max-w-narrow: 800px;

  /* Radius */
  --r-sm: 4px;
  --r:    8px;
  --r-lg: 12px;

  /* Section spacing */
  --s-hero:    clamp(64px, 7vw, 112px);
  --s-section: clamp(52px, 6vw, 92px);
  --s-tight:   clamp(28px, 3vw, 44px);

  /* Transitions */
  --t:      180ms ease;
}

@media (min-width: 1920px) {
  :root {
    --s-hero:    128px;
    --s-section: 104px;
    --s-tight:   52px;
  }
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--ink-900);
  background: var(--white);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
ul, ol { list-style: none; }
button { font-family: var(--font); }

/* --- Typography helpers --- */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-400);
  margin-bottom: 12px;
}
.eyebrow--dark   { color: rgba(226, 232, 240, 0.50); }
.eyebrow--accent { color: var(--accent); }

h1 { font-size: clamp(36px, 4.8vw, 60px); font-weight: 700; line-height: 1.08; letter-spacing: -0.025em; }
h2 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 700; line-height: 1.12; letter-spacing: -0.02em; }
h3 { font-size: clamp(17px, 1.8vw, 20px); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }

.section-lead {
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink-500);
  max-width: 640px;
  margin-top: 16px;
}

/* --- Layout --- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 48px;
}
.container--narrow { max-width: var(--max-w-narrow); }

@media (max-width: 768px) {
  .container { padding: 0 20px; }
}

/* --- Header / Nav --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--dark);
  border-bottom: 1px solid var(--dark-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 24px;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--dark-text);
}
.brand-icon { width: 30px; height: 30px; }
.brand-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.primary-nav a {
  font-size: 14px;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.78);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: color var(--t), background var(--t);
}
.primary-nav a:hover,
.primary-nav a.is-active {
  color: var(--dark-text);
  background: rgba(255, 255, 255, 0.07);
}
.nav-portal {
  margin-left: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: var(--r) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  white-space: nowrap;
  background: transparent !important;
}
.nav-portal:hover { border-color: rgba(255, 255, 255, 0.50) !important; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--dark-text);
  border-radius: 2px;
  transition: transform var(--t), opacity var(--t);
}
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--dark);
    border-bottom: 1px solid var(--dark-border);
    padding: 12px 20px 16px;
    display: none;
    z-index: 99;
  }
  .primary-nav.is-open { display: flex; }
  .primary-nav a { padding: 10px 12px; font-size: 15px; }
  .nav-portal { margin-left: 0 !important; margin-top: 4px; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--r);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t), border-color var(--t);
  text-decoration: none !important;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--white); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary { background: transparent; color: var(--ink-700); border-color: var(--ink-200); }
.btn-secondary:hover { border-color: var(--ink-400); color: var(--ink-900); }
.btn-ghost { background: transparent; color: var(--dark-text); border-color: rgba(255,255,255,0.22); }
.btn-ghost:hover { border-color: rgba(255,255,255,0.50); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 16px; }

/* --- Sections --- */
.section      { padding: var(--s-section) 0; }
.section--alt { background: var(--ink-50); }
.section--dark { background: var(--dark); }
.section--border-top    { border-top: 1px solid var(--ink-200); }
.section--border-bottom { border-bottom: 1px solid var(--ink-200); }
.section-header { margin-bottom: 44px; }
.section-header--center { text-align: center; }
.section-header--center .section-lead { margin-left: auto; margin-right: auto; }
.section--dark h2,
.section--dark h3          { color: var(--dark-text); }
.section--dark .section-lead { color: var(--dark-muted); }
.section--dark .eyebrow     { color: rgba(226, 232, 240, 0.50); }

/* Page hero (dark, top of interior pages) */
.page-hero {
  background: var(--dark);
  padding: var(--s-hero) 0;
}
.page-hero h1            { color: var(--dark-text); }
.page-hero .section-lead { color: var(--dark-muted); max-width: 640px; }
.page-hero .eyebrow      { color: rgba(226, 232, 240, 0.50); }
.hero-actions { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }

/* Section CTA (dark, centered) */
.section-cta { text-align: center; }
.section-cta h2 { color: var(--dark-text); }
.section-cta .section-lead { color: var(--dark-muted); margin-left: auto; margin-right: auto; }
.cta-actions { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }

/* --- Cards --- */
.card {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: border-color var(--t), box-shadow var(--t);
}
.card:hover {
  border-color: var(--ink-400);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}
.card-title { font-size: 17px; font-weight: 600; color: var(--ink-900); margin-bottom: 10px; letter-spacing: -0.01em; }
.card-body  { font-size: 15px; line-height: 1.65; color: var(--ink-500); }

/* Cards on alternate (light gray) background */
.card--on-alt { background: var(--white); }

/* --- Footer --- */
.site-footer {
  background: var(--white);
  border-top: 1px solid var(--ink-200);
  padding: var(--s-tight) 0;
}
.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 28px;
}
.footer-col { display: flex; flex-direction: column; gap: 8px; min-width: 120px; }
.footer-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-400); }
.footer-copy  { font-size: 13px; color: var(--ink-500); line-height: 1.6; }
.footer-copy a { transition: color var(--t); }
.footer-copy a:hover { color: var(--ink-900); }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { font-size: 13px; color: var(--ink-500); transition: color var(--t); }
.footer-links a:hover { color: var(--ink-900); }
@media (max-width: 600px) {
  .footer-inner { gap: 20px; }
  .footer-col { min-width: calc(50% - 10px); }
}

/* --- Forms --- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--ink-700); margin-bottom: 6px; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink-900);
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r);
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
  appearance: none;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-input.is-error, .form-textarea.is-error { border-color: #DC2626; }
.form-error { font-size: 13px; color: #DC2626; margin-top: 4px; display: none; }
.form-error.is-visible { display: block; }
.form-textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.form-hint { font-size: 13px; color: var(--ink-400); margin-top: 12px; }

/* --- Focus --- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* --- Utilities --- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.mt-sm { margin-top: 12px; }
.mt-md { margin-top: 24px; }
.mt-lg { margin-top: 40px; }

/* --- Fade-in (IntersectionObserver-driven, only when JS loads) --- */
/* [data-js] ensures elements are visible without JavaScript */
[data-js] .fade-in {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 380ms ease, transform 380ms ease;
}
.fade-in.is-visible { opacity: 1; transform: translateY(0); }

/* Anchor offset for sticky header */
[id] { scroll-margin-top: 80px; }

@media (prefers-reduced-motion: reduce) {
  [data-js] .fade-in { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
