/* ============================================================
   Baldwin Business Systems — Design System
   Source of truth: /design/DESIGN.md ("The Architectural Editor")
   This file is the ONLY place visual tokens/components live.
   Class names below are the public API consumed by every page —
   do not rename them without updating every .astro file that uses
   them (see src/layouts/Header.astro, Footer.astro, and src/pages/**).
   ============================================================ */

:root {
  /* Primary palette */
  --color-primary: #005ba1;
  --color-primary-container: #0074cb;
  --color-on-primary: #ffffff;

  /* Surface hierarchy (tonal layering, per DESIGN.md §4) */
  --color-surface: #f5faff;
  --color-surface-container-low: #eef4fa;
  --color-surface-container-lowest: #ffffff;
  --color-surface-container-high: #e2ecf5;
  --color-surface-container-highest: #d5e2ef;

  --color-on-surface: #161c21;
  --color-on-surface-variant: #44484e;

  /* Accent */
  --color-secondary-container: #8efa96;
  --color-on-secondary-container: #007529;

  /* Ghost border fallback (10–20% opacity only, per DESIGN.md §4) */
  --color-outline-variant: #c2c7ce;

  /* Status */
  --color-error: #cf2e2e;
  --color-success: #2e9c45;

  /* Ambient shadows — never pure black, always tinted on-surface */
  --shadow-ambient: 0 28px 40px -4px rgba(22, 28, 33, 0.07);
  --shadow-ambient-sm: 0 16px 28px -6px rgba(22, 28, 33, 0.06);

  /* Typography */
  --font-display: 'Plus Jakarta Sans', 'Montserrat', sans-serif;
  --font-body: 'Inter', 'Open Sans', sans-serif;

  /* Roundedness — applied consistently, per DESIGN.md §6 */
  --radius-xl: 0.75rem;

  /* Spacing scale */
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.25rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.25rem;
  --space-3xl: 2.5rem;
  --space-4xl: 3.25rem;
  --space-5xl: 5.75rem;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-on-surface);
  background: var(--color-surface);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary-container); }
a:hover { color: var(--color-primary); }
main { min-height: 60vh; }

/* ── Typography (DESIGN.md §3: Authority & Precision) ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  line-height: 1.2;
  color: var(--color-on-surface);
}
h1 { font-size: 3.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-size: 2rem; font-weight: 600; line-height: 1.25; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-on-surface-variant);
  margin: 0 0 1.25rem 0;
}
small, .caption {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--color-on-surface-variant);
}
.text-sm { font-size: 0.875rem; line-height: 1.7; }
.text-link { font-size: 0.875rem; line-height: 1.75rem; }

/* Type-scale utilities matching DESIGN.md token names directly */
.display-lg { font-family: var(--font-display); font-size: 3.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.headline-lg { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.25; }
.headline-md { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; line-height: 1.3; color: var(--color-primary-container); }
.headline-sm { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.body-lg { font-size: 1rem; line-height: 1.7; }
.label-md {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Section Containers (no hard lines — tonal shifts only) ── */
.section-container { max-width: 1200px; margin: 0 auto; padding: var(--space-5xl) var(--space-md); }
.section-container-sm { padding: var(--space-4xl) var(--space-md); }
.section-container-lg { padding: var(--space-5xl) var(--space-md); }
.section-surface { background: var(--color-surface-container-low); }
.section-white { background: var(--color-surface-container-lowest); }
.section-container-flush { padding: 0; }

/* ── Hero ── */
.hero-section {
  background: linear-gradient(135deg, var(--color-surface), var(--color-surface-container-low));
  padding: var(--space-5xl) var(--space-md);
  text-align: center;
}
.hero-section h1 { max-width: 900px; margin: 0 auto 1.5rem; }
.hero-section p { max-width: 750px; margin: 0 auto 2rem; }

/* ── Industry / Trust Grid ── */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-sm);
  max-width: 900px;
  margin: 0 auto var(--space-3xl);
}

/* ── Process Steps ── */
.process-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }
.process-step { text-align: center; }
.process-step .step-number { font-size: 2rem; margin-bottom: var(--space-sm); color: var(--color-primary-container); font-family: var(--font-display); font-weight: 700; }

/* ── Split Layout ── */
.split-layout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4xl); align-items: center; }

/* ── Pain Cards Grid ── */
.pain-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2xl); }

/* ── CTA Section ── */
.cta-section { padding: var(--space-5xl) var(--space-md); text-align: center; }
.cta-section .cta-inner { max-width: 640px; margin: 0 auto; }

/* ── Header / Navigation (glassmorphic, no border — DESIGN.md §2) ── */
.site-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-ambient-sm);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}
.logo-link img { height: 60px; width: auto; display: block; }
.header-phone {
  font-size: 0.875rem;
  font-family: var(--font-body);
  color: var(--color-on-surface);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  line-height: 1.75rem;
  white-space: nowrap;
}
.header-phone:hover { color: var(--color-primary-container); }

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.125rem;
  color: var(--color-on-surface);
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-xl);
}
.nav-toggle:hover { background: var(--color-surface-container-low); }

.primary-nav {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 0.875rem;
  font-family: var(--font-body);
  line-height: 1.75rem;
}
.primary-nav > a,
.primary-nav > .nav-dropdown > a {
  padding: 0.5rem 0.75rem;
  color: var(--color-on-surface);
  text-decoration: none;
  border-radius: var(--radius-xl);
  transition: color 0.15s, background-color 0.15s;
  line-height: 1.75rem;
}
.primary-nav > a:hover,
.primary-nav > .nav-dropdown > a:hover {
  color: var(--color-primary-container);
  background: var(--color-surface-container-low);
}
.primary-nav > a.active,
.primary-nav > .nav-dropdown > a.active {
  color: var(--color-primary-container);
  font-weight: 600;
  background: var(--color-surface-container-low);
}
.nav-dropdown { position: relative; }
.nav-dropdown .dropdown-menu {
  display: none;
  position: absolute;
  /* top: 100% with no margin keeps the menu flush against the nav link —
     a gap here creates a dead zone the cursor has to cross, which closes
     the menu via :hover before it reaches the dropdown. */
  top: 100%;
  left: 0;
  padding-top: 0.5rem;
  min-width: 240px;
  background: var(--color-surface-container-lowest);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-ambient);
  padding-bottom: 0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  z-index: 100;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--color-on-surface);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.5rem;
  border-radius: var(--radius-xl);
  white-space: nowrap;
}
.dropdown-menu a:hover { color: var(--color-primary-container); background: var(--color-surface-container-low); }
.dropdown-menu a.active { color: var(--color-primary-container); font-weight: 600; }

/* ── Buttons (DESIGN.md §5: The Tactile Interaction) ── */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.75rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-xl);
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  min-height: 44px;
  min-width: 44px;
}
/* Primary: gradient fill, per DESIGN.md "Gradient Blue" */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-container));
  color: var(--color-on-primary);
}
.btn-primary:hover {
  color: var(--color-on-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-ambient-sm);
}
.btn-primary:active { color: var(--color-on-primary); transform: translateY(0); }
.btn-primary:disabled {
  background: var(--color-outline-variant);
  color: var(--color-on-surface-variant);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
/* Secondary: tonal fill, no border */
.btn-secondary { background: var(--color-surface-container-highest); color: var(--color-on-surface); }
.btn-secondary:hover { color: var(--color-on-surface); transform: translateY(-1px); }
.btn-secondary:active { color: var(--color-on-surface); transform: translateY(0); }
.btn-secondary:disabled {
  background: var(--color-outline-variant);
  color: var(--color-on-surface-variant);
  cursor: not-allowed;
  transform: none;
}
/* Pill variant — apply alongside btn-primary or btn-secondary */
.btn-pill {
  border-radius: 9999px;
  padding-left: 2rem;
  padding-right: 2rem;
}
/* Tertiary/Ghost: transparent, underline expands on hover */
.btn-ghost { background: transparent; color: var(--color-on-surface); padding: 0.5rem 0.75rem; position: relative; }
.btn-ghost::after {
  content: '';
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.3rem;
  height: 2px;
  background: var(--color-primary-container);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.btn-ghost:hover { color: var(--color-primary-container); }
.btn-ghost:hover::after { transform: scaleX(1); }

/* ── Cards & Category Cards (DESIGN.md §5: Separation Rule, no dividers) ── */
.card {
  background: var(--color-surface-container-lowest);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-ambient-sm);
}
.card-grid { display: grid; gap: var(--space-2xl); }
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid-1 { grid-template-columns: 1fr; }

.category-card {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-container));
  color: var(--color-on-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-xl);
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  display: block;
  box-shadow: var(--shadow-ambient-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.category-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-ambient); }

/* ── Chips (DESIGN.md §5: Subtle Indicator) ── */
.chip {
  display: inline-block;
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xl);
}

/* ── Forms (DESIGN.md §5: Clean Slate) ── */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-on-surface);
  margin-bottom: 0.5rem;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--color-surface-container-high);
  border: none;
  border-radius: var(--radius-xl);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-family: var(--font-body);
  color: var(--color-on-surface);
  line-height: 1.75rem;
  min-height: 44px;
  transition: box-shadow 0.15s ease;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  /* "Ghost Border" focus state: primary at 40% opacity, no heavy glow */
  box-shadow: 0 0 0 2px rgba(0, 91, 161, 0.4) inset;
}
.form-textarea { min-height: 120px; resize: vertical; }
.form-error { box-shadow: 0 0 0 2px var(--color-error) inset; }
.form-error-msg { color: var(--color-error); font-size: 0.75rem; margin-top: 0.25rem; }
.form-success { box-shadow: 0 0 0 2px var(--color-success) inset; background: var(--color-surface-container-low); }
.form-success-msg { color: var(--color-success); font-size: 0.75rem; }

/* ── Inline Links ── */
.inline-link {
  font-size: 1rem;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--color-primary-container);
  text-decoration: underline;
  line-height: 1.75;
  cursor: pointer;
}
.inline-link:hover { color: var(--color-primary); }
.inline-link:visited { color: var(--color-on-surface-variant); }

/* ── Footer ── */
.site-footer {
  background: var(--color-on-surface);
  color: #ffffff;
  padding: var(--space-4xl) var(--space-md) var(--space-lg);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3xl);
}
.footer-col h3 {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-sm);
  color: #ffffff;
}
.footer-col p { font-size: 0.875rem; line-height: 1.7; color: rgba(255, 255, 255, 0.75); margin: 0 0 0.5rem; }
.footer-col a { color: rgba(255, 255, 255, 0.65); text-decoration: none; font-size: 0.875rem; display: block; margin-bottom: 0.4rem; }
.footer-col a:hover { color: #ffffff; }
.footer-contact strong { color: #ffffff; }
.footer-bottom {
  max-width: 1200px;
  margin: var(--space-xl) auto 0;
  padding-top: var(--space-lg);
  text-align: center;
}
.footer-bottom p { font-size: 0.75rem; color: rgba(255, 255, 255, 0.4); margin: 0; }

/* ── Skip Link (a11y) ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 0.75rem 1.25rem;
  background: var(--color-primary-container);
  color: #ffffff;
  border-radius: 0 0 var(--radius-xl) 0;
  text-decoration: none;
}
.skip-link:focus { left: 1rem; }

/* ── Client Logo Carousel (ready for use with public/assets/images/clients_logos) ── */
.logo-carousel { overflow: hidden; width: 100%; position: relative; padding: 0.625rem 0; }
.logo-carousel-track {
  display: flex;
  flex-wrap: nowrap;
  gap: 3.125rem;
  animation: scroll-logos 60s linear infinite;
  width: max-content;
}
.logo-carousel:hover .logo-carousel-track { animation-play-state: paused; }
.logo-carousel-track figure {
  flex: 0 0 auto;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  text-align: center;
}
.logo-carousel-track img { height: 80px; width: auto; object-fit: contain; }
.logo-carousel-track figcaption {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--color-on-surface-variant);
  white-space: nowrap;
  text-align: center;
}
@keyframes scroll-logos {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Responsive ── */
@media (max-width: 767px) {
  .nav-toggle { display: block; }
  .header-phone { display: none; }
  .primary-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--color-surface-container-lowest);
    box-shadow: var(--shadow-ambient);
    padding: var(--space-sm);
    flex-direction: column;
    align-items: stretch;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 100;
  }
  .primary-nav.open { display: flex; }
  .nav-dropdown .dropdown-menu {
    position: static;
    box-shadow: none;
    padding-left: var(--space-sm);
    display: none;
  }
  .nav-dropdown.open .dropdown-menu { display: block; }
  .site-header { position: sticky; top: 0; z-index: 50; }
  .section-container { padding: var(--space-3xl) var(--space-sm); }
  .card-grid-3, .card-grid-2 { grid-template-columns: 1fr; }
  .hero-section { padding: var(--space-3xl) var(--space-sm); }
  .pain-grid, .process-grid { grid-template-columns: 1fr; }
  .split-layout { grid-template-columns: 1fr; }
  h1 { font-size: 2rem; }
  .btn { width: 100%; }
}
@media (min-width: 768px) and (max-width: 1199px) {
  .section-container { padding: var(--space-4xl) var(--space-md); }
  .hero-section { padding: var(--space-4xl) var(--space-md); }
  .card-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .pain-grid { grid-template-columns: repeat(2, 1fr); }
  .process-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1200px) {
  .card-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .site-header { position: sticky; top: 0; z-index: 50; }
}
@media (min-width: 1400px) {
  .section-container { max-width: 1200px; margin: 0 auto; }
}

/* ── Small utilities used by content pages to avoid inline styles ── */
.u-text-center { text-align: center; }
.u-muted { color: var(--color-on-surface-variant); }
.u-mt-xs { margin-top: var(--space-xs); }
.u-mt-sm { margin-top: var(--space-md); }
.u-mb-lg { margin-bottom: var(--space-lg); }
.u-mb-xs { margin-bottom: var(--space-xs); }
.section-intro-text { max-width: 700px; margin-left: auto; margin-right: auto; }

/* ── Reusable content patterns ── */
.section-intro { text-align: center; margin-bottom: var(--space-3xl); }
.section-intro p { max-width: 700px; margin: 0 auto; }
.section-stat { text-align: center; }

.quote-card { text-align: center; padding: var(--space-3xl) var(--space-xl); }
.quote-card p { font-style: italic; color: var(--color-on-surface-variant); }
.quote-card .caption { margin-top: var(--space-sm); }

.cta-actions { display: flex; gap: var(--space-sm); justify-content: center; flex-wrap: wrap; }


/* ── Lists (used throughout service/industry detail content) ── */
ul, ol { margin: 0 0 1.25rem 0; padding-left: 1.25rem; color: var(--color-on-surface-variant); }
li { margin-bottom: 0.5rem; line-height: 1.7; }
ul li::marker, ol li::marker { color: var(--color-primary-container); }
.card ul, .card ol { margin-bottom: 0; }

/* ── Content image (hero/detail images inside body copy) ── */
.content-image {
  width: 100%;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-ambient-sm);
  margin-bottom: var(--space-sm);
}
.content-image-row { margin-bottom: var(--space-2xl); }
.content-image-row .caption { text-align: center; margin-top: var(--space-xs); }

/* ── Feature list (bold lead-in + supporting list, e.g. "Who this is for") ── */
.feature-list { margin-bottom: var(--space-lg); }
.feature-list > strong { display: block; margin-bottom: var(--space-xs); color: var(--color-on-surface); }

/* ── Industry/use-case tag list (label + short description pairs) ── */
.tag-list { list-style: none; padding-left: 0; }
.tag-list li { padding-left: 0; }
.tag-list strong { color: var(--color-on-surface); }

/* ── FAQ blocks ── */
.faq-item { margin-bottom: var(--space-lg); }
.faq-item .faq-q { font-weight: 700; color: var(--color-on-surface); margin-bottom: 0.4rem; }
.faq-item .faq-a { margin-bottom: 0; }

/* ── Numbered reason list (e.g. "Why It Matters") ── */
.reason-grid { display: grid; gap: var(--space-xl); }
.reason-grid h3 { color: var(--color-primary-container); }
