/* =====================================================================
 * Braigns Inc. shared stylesheet
 * Loaded by index.html and products.html. Page-specific styles live in
 * <style> blocks on each page.
 * ===================================================================== */

/* ---------- Brand tokens ---------- */
:root {
  --ink:        #0E1116;
  --paper:      #F8F6F0;
  --paper-2:    #F1EFE8;
  --surface:    #FFFFFF;
  --ink-muted:  #5C6470;
  --hairline:   #E2E0DA;
  --sovereign:  #1A2A52;
  --sovereign-hover: #142244;
  --citation:   #A8302A;

  --font-display: 'Source Serif 4', 'Iowan Old Style', Georgia, serif;
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --container: 1180px;
  --section-y: clamp(5rem, 10vw, 7.5rem);
}

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

body {
  font-family: var(--font-ui);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0;
}
p { margin: 0; }

.display-xl { font-size: clamp(2.75rem, 6.5vw, 5rem); font-weight: 700; line-height: 1.04; letter-spacing: -0.02em; }
.display-lg { font-size: clamp(1.875rem, 4vw, 2.75rem); font-weight: 700; }
.display-md { font-size: clamp(1.375rem, 2.5vw, 1.85rem); font-weight: 600; }

.body-lg { font-size: 1.125rem; line-height: 1.65; color: var(--ink-muted); max-width: 65ch; }
.body    { font-size: 1.0625rem; line-height: 1.6; color: var(--ink-muted); max-width: 65ch; }
.small   { font-size: 0.9375rem; line-height: 1.55; color: var(--ink-muted); }
.caption { font-size: 0.8125rem; line-height: 1.5; color: var(--ink-muted); }

.eyebrow {
  font-family: var(--font-ui);
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--sovereign);
}
.eyebrow.on-dark { color: var(--paper); opacity: 0.78; }

.mono {
  font-family: var(--font-mono); font-weight: 500;
  font-size: 0.92em; letter-spacing: -0.01em;
}

.citation { color: var(--citation); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Layout primitives ---------- */
.container-narrow { max-width: var(--container); margin-inline: auto; padding-inline: 1.5rem; }
section { padding-block: var(--section-y); }
.section-dark { background: var(--ink); color: var(--paper); }
.section-dark h1, .section-dark h2, .section-dark h3, .section-dark h4 { color: var(--paper); }
.section-dark .body, .section-dark .body-lg, .section-dark .small, .section-dark .caption { color: rgba(248,246,240,0.72); }

/* ---------- Skip-link & focus ring (a11y) ---------- */
.skip-link {
  position: absolute; left: 1rem; top: 1rem;
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 0.875rem; border-radius: 4px;
  font-size: 0.875rem; font-weight: 500;
  transform: translateY(-200%);
  transition: transform 0.15s ease;
  z-index: 100;
}
.skip-link:focus { transform: translateY(0); outline: 2px solid var(--paper); outline-offset: 2px; }

:focus-visible { outline: 2px solid var(--sovereign); outline-offset: 2px; border-radius: 2px; }
.section-dark :focus-visible { outline-color: var(--paper); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 1.4rem; border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.9375rem; font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--sovereign); color: var(--paper); }
.btn-primary:hover { background: var(--sovereign-hover); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(26,42,82,0.18); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-on-dark-primary { background: var(--paper); color: var(--ink); }
.btn-on-dark-primary:hover { background: var(--surface); transform: translateY(-1px); }
.btn-on-dark-ghost { background: transparent; color: var(--paper); border-color: rgba(248,246,240,0.4); }
.btn-on-dark-ghost:hover { border-color: var(--paper); background: rgba(248,246,240,0.06); }
.btn-secondary { background: var(--surface); color: var(--ink-muted); border-color: var(--hairline); }
.btn-secondary:hover { color: var(--ink); border-color: var(--ink-muted); }
.btn-sm { padding: 0.55rem 0.95rem; font-size: 0.875rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 8px; padding: 2rem;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { border-color: #C9C7BF; box-shadow: 0 4px 14px rgba(14,17,22,0.05); transform: translateY(-1px); }

/* ---------- Wordmark ---------- */
.wordmark {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.4rem;
  letter-spacing: -0.02em; color: var(--ink); line-height: 1;
  white-space: nowrap;
}
.wordmark .citation-mark { color: var(--citation); }

/* ---------- Navigation ---------- */
.nav-bar {
  background: rgba(248,246,240,0.94);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.nav-link {
  font-size: 0.9375rem; font-weight: 500;
  color: var(--ink); text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}
.nav-link:hover { color: var(--sovereign); }
.nav-link[aria-current="true"],
.nav-link[aria-current="page"] { color: var(--sovereign); }
.nav-link[aria-current="true"]::after,
.nav-link[aria-current="page"]::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 1.5px; background: var(--sovereign);
}

/* ---------- Mobile menu ---------- */
.mobile-menu {
  overflow: hidden; max-height: 0; opacity: 0;
  transition: max-height 0.2s ease, opacity 0.2s ease;
  background: var(--paper); border-top: 1px solid var(--hairline);
}
.mobile-menu.open { max-height: 480px; opacity: 1; }
.mobile-menu .nav-link { display: block; padding: 0.85rem 1.5rem; }

/* ---------- Logo strip ---------- */
.logo-strip img {
  max-height: 36px; width: auto;
  filter: grayscale(1) contrast(0.92);
  opacity: 0.6;
  transition: opacity 0.2s ease, filter 0.2s ease;
}
.logo-strip a:hover img,
.logo-strip a:focus-visible img { opacity: 0.95; filter: grayscale(0); }

/* ---------- Form inputs ---------- */
.input {
  width: 100%; padding: 0.85rem 1rem;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 6px;
  color: var(--ink); font-family: inherit; font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input::placeholder { color: #9AA0A8; }
.input:focus-visible {
  outline: none;
  border-color: var(--sovereign);
  box-shadow: 0 0 0 3px rgba(26,42,82,0.15);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(14,17,22,0.55);
  z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-content {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 2.25rem;
  max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto;
  transform: scale(0.97); opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.modal-overlay:not(.hidden) .modal-content { transform: scale(1); opacity: 1; }

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.visible { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
