/* ============================================================
   Applied Intelligence — common styles
   Shared by all pages: reset, variables, nav, layout, footer
   ============================================================ */

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

:root {
  --bg:       #f5f2eb;
  --bg-alt:   #faf8f3;
  --bg-soft:  #edeade;
  --bg-white: #ffffff;
  --ink:      #1a1a18;
  --ink-soft: #4a4a42;
  --ink-mute: #8a8a78;
  --ember:    #c4510a;
  --ember-h:  #a34308;
  --ember-lt: #f5e6d8;
  --rule:     #dedad0;
  --nav-bg:   #1a1a18;
  --nav-text: #f5f2eb;
  --nav-mute: rgba(245,242,235,0.55);
  --sans: "DM Sans", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;

  --side:  clamp(32px, 6vw, 120px);
  --gap:   clamp(80px, 10vw, 140px);
  --wide:  1320px;
  --text:  760px;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
img, svg { display: block; max-width: 100%; }

/* ——— Nav (full-width dark bar) ——— */
.nav {
  background: var(--nav-bg);
  color: var(--nav-text);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 var(--side);
}
.nav-inner {
  max-width: var(--wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}
.nav-logo {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-links {
  display: flex;
  gap: clamp(20px, 3vw, 40px);
  list-style: none;
  font-size: 14px;
}
.nav-links a {
  color: var(--nav-mute);
  transition: color .15s;
}
.nav-links a:hover { color: var(--nav-text); }
.nav-links a.active { color: var(--nav-text); }
.nav-cta {
  background: var(--ember);
  color: #fff;
  padding: 9px 21px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
  transition: background .15s;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--ember-h); }

/* Groups the CTA with the mobile menu button so nav-inner's three-way
   space-between (logo / links / actions) holds at every width, rather than
   the button landing wherever space-between happens to put a fourth item. */
.nav-actions { display: flex; align-items: center; gap: 14px; }

/* Hamburger toggle — hidden on desktop, shown once .nav-links is hidden below. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 0;
}
.nav-toggle .bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--nav-text);
  border-radius: 1px;
  transition: transform .2s, opacity .2s;
}
/* Bars morph into a close (X) glyph so the open state doesn't need a second icon. */
.nav-toggle[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }

  /* var(--side) alone (min 32px each edge) plus the logo, CTA and toggle at their
     desktop sizes overflow a narrow phone — the toggle was landing clipped against
     the right edge. Tightened for this bar only; var(--side) itself is untouched,
     so every other section's padding is unaffected. */
  .nav { padding: 0 16px; }
  .nav-inner { gap: 12px; }
  .nav-logo { font-size: 13px; letter-spacing: 0.3px; }
  .nav-actions { gap: 10px; }
  .nav-cta { padding: 8px 14px; font-size: 13px; }

  /* The dropdown panel. Fixed (not absolute) so it doesn't depend on nav-inner's
     max-width/centering box — it always spans the full viewport regardless of
     how narrow the actual nav bar's content column is. */
  .nav-links.is-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    background: var(--nav-bg);
    padding: 8px var(--side) 16px;
    gap: 0;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    font-size: 15px;
  }
  .nav-links.is-open a {
    padding: 14px 0;
    border-bottom: 1px solid rgba(245, 242, 235, 0.12);
  }
  .nav-links.is-open a:last-child { border-bottom: none; }
}

/* ——— Section shell (full-width, generous padding) ——— */
.sec {
  padding: var(--gap) var(--side);
}
.sec-inner {
  max-width: var(--wide);
  margin: 0 auto;
}
.sec-text {
  max-width: var(--text);
  margin: 0 auto;
  text-align: center;
}

/* Alternating backgrounds */
.sec-bg-white  { background: var(--bg-white); }
.sec-bg-alt   { background: var(--bg-alt); }
.sec-bg-soft  { background: var(--bg-soft); }
.sec-bg-dark  { background: var(--nav-bg); color: var(--nav-text); }

/* ——— Typography (shared) ——— */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-mute);
  margin-bottom: 16px;
}
h2.centered { text-align: center; }

/* ——— Footer ——— */
.footer {
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: clamp(48px, 6vw, 72px) var(--side);
}
.footer-inner {
  max-width: var(--wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 40px;
}
.footer-col { font-size: 14px; min-width: 140px; }
.footer-col h5 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 14px;
}
.footer-col a, .footer-col p {
  color: var(--nav-mute);
  line-height: 2;
  display: block;
  transition: color .15s;
}
.footer-col a:hover { color: var(--nav-text); }
