/* ==========================================================================
   NanoLeap Design System — v2 INSTITUTIONAL
   Single source of truth for the entire site.
   Aesthetic: Liberty/Old Mutual/Allan Gray — institutional serif + clean sans.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* PAPER */
  --cream: #FBF8F1;          /* Primary page background — warmer than pure cream */
  --cream-deep: #F1ECE0;     /* Section alternates */
  --white: #FFFFFF;          /* Card surfaces */

  /* INK */
  --navy: #0A2540;            /* Primary brand ink — deeper, more institutional */
  --navy-deep: #051528;
  --navy-soft: #2D3A52;
  --ink: #1F2937;
  --ink-2: #525866;
  --ink-3: #6B7280;

  /* ACCENTS */
  --gold: #B8860B;            /* Institutional gold for tags & accents — premium feel */
  --gold-light: #D4A437;
  --gold-bg: #FAF3E0;

  --blue: #0F4C81;            /* Trust-blue, deeper than electric */
  --blue-bright: #2563EB;     /* CTA blue, bolder */
  --blue-bg: #EFF4FB;

  --green: #065F46;           /* Forest green — institutional, not startup green */
  --green-bright: #047857;
  --green-bg: #ECFDF5;

  --red: #991B1B;             /* Burgundy red, not alarm red */
  --red-bg: #FEF2F2;

  /* LINES */
  --line: #E5E7EB;
  --line-strong: #D1D5DB;
  --rule: #0A2540;            /* Heavy navy rule for institutional dividers */

  /* TYPE */
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* TYPOGRAPHY — serif display, sans body, mono labels */
h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--navy-deep);
  letter-spacing: -0.015em;
  line-height: 1.2;
  font-weight: 600;
}
h1 { font-size: clamp(36px, 5vw, 56px); line-height: 1.05; letter-spacing: -0.025em; font-weight: 600; }
h2 { font-size: clamp(28px, 3.5vw, 40px); line-height: 1.15; font-weight: 600; }
h3 { font-size: clamp(20px, 2vw, 24px); }
h4 { font-size: 18px; }

p { font-size: 17px; line-height: 1.65; color: var(--ink); }
.lede { font-family: var(--serif); font-size: clamp(19px, 1.5vw, 22px); line-height: 1.55; color: var(--navy-soft); font-weight: 400; }

/* MONO LABELS */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.caps-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* CONTAINER */
.container { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
.container-narrow { max-width: 740px; margin: 0 auto; padding: 0 28px; }

/* ============ NAV BAR ============ */
.nav {
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  background: rgba(251, 248, 241, 0.92);
}
.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-mark {
  width: 28px; height: 28px;
  background: var(--navy);
  border-radius: 4px;
  padding: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1.5px;
  flex-shrink: 0;
}
.brand-mark span { border-radius: 1px; display: block; }
.brand-mark span:nth-child(1) { background: #1B4F8C; }
.brand-mark span:nth-child(2) { background: #4A90E2; }
.brand-mark span:nth-child(3) { background: #6FA8E5; }
.brand-mark span:nth-child(4) { background: #2D4F8A; }
.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  color: var(--navy-deep);
  letter-spacing: -0.015em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
  list-style: none;
}
.nav-links a {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  transition: color 0.15s;
  position: relative;
}
.nav-links a:hover { color: var(--navy-deep); }
.nav-links a.active { color: var(--navy-deep); font-weight: 600; }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -28px;
  height: 2px;
  background: var(--navy);
}
.nav-cta {
  background: var(--navy);
  color: var(--white);
  padding: 11px 20px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-cta:hover { background: var(--navy-deep); }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-inner { height: 64px; }
  .nav-links, .nav-cta { display: none; }
  .nav-toggle {
    display: block;
    width: 28px; height: 28px;
    position: relative;
  }
  .nav-toggle::before, .nav-toggle::after {
    content: ""; position: absolute; left: 4px; right: 4px; height: 2px;
    background: var(--navy);
  }
  .nav-toggle::before { top: 9px; }
  .nav-toggle::after { bottom: 9px; }
  .nav.open .nav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
    padding: 24px 28px;
    gap: 20px;
    align-items: flex-start;
  }
  .nav.open .nav-cta { display: inline-block; margin-top: 16px; }
  .nav.open .nav-links a.active::after { display: none; }
}

/* ============ HERO ============ */
.hero {
  padding: 80px 0 100px;
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  left: 0; top: 80px; bottom: 100px;
  width: 1px;
  background: var(--rule);
}
@media (max-width: 860px) {
  .hero { padding: 56px 0 72px; }
  .hero::before { left: -28px; top: 56px; bottom: 72px; }
}
.hero-eyebrow { margin-bottom: 24px; }
.hero h1 { margin-bottom: 28px; max-width: 14ch; }
.hero h1 em { font-style: italic; color: var(--blue); font-weight: 500; }
.hero .lede { max-width: 620px; margin-bottom: 36px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 26px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  border-radius: 4px;
  transition: all 0.15s;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover { background: var(--navy-deep); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--navy);
}
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-ghost { color: var(--navy); }
.btn-ghost:hover { color: var(--blue-bright); }
.btn-ghost::after { content: "→"; transition: transform 0.15s; }
.btn-ghost:hover::after { transform: translateX(4px); }

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* ============ CARDS / PANELS ============ */
.card {
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 32px;
}
.card-flat {
  background: var(--white);
  border-top: 2px solid var(--rule);
  padding: 32px 0;
}
.section { padding: 80px 0; }
.section-tight { padding: 48px 0; }
.section-deep { background: var(--cream-deep); padding: 80px 0; }

/* RULE LINES — institutional dividers */
.rule {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 48px;
}
.rule .num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.rule .line { flex: 1; height: 1px; background: var(--rule); }

/* ============ STAT BLOCK (institutional, not startup) ============ */
.stat-block {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 2px solid var(--rule);
  border-bottom: 1px solid var(--line);
  padding: 36px 0;
  margin: 48px 0;
}
.stat-block .stat {
  padding: 0 24px;
  border-right: 1px solid var(--line);
}
.stat-block .stat:last-child { border-right: none; }
.stat-block .stat:first-child { padding-left: 0; }
.stat-block .stat .v {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 600;
  color: var(--navy-deep);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 8px;
}
.stat-block .stat .l {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}
@media (max-width: 700px) {
  .stat-block { grid-template-columns: 1fr; gap: 32px; padding: 32px 0; }
  .stat-block .stat { border-right: none; border-bottom: 1px solid var(--line); padding: 0 0 32px; }
  .stat-block .stat:last-child { border-bottom: none; padding-bottom: 0; }
}

/* ============ NUMBERED ARTICLE LIST ============ */
.article-list { display: grid; gap: 0; }
.article-list .item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 24px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}
.article-list .item:first-child { border-top: 1px solid var(--rule); border-top-width: 2px; }
.article-list .item .num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
  padding-top: 4px;
}
.article-list .item h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--navy-deep);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.article-list .item p {
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1.6;
  margin-bottom: 8px;
}
.article-list .item .pain {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--red);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ============ CALLOUTS ============ */
.callout {
  padding: 24px 28px;
  border-left: 2px solid;
  border-radius: 0 4px 4px 0;
  margin: 28px 0;
  background: var(--white);
}
.callout-info { border-color: var(--blue); background: var(--blue-bg); }
.callout-warn { border-color: var(--red); background: var(--red-bg); }
.callout-tip { border-color: var(--green-bright); background: var(--green-bg); }
.callout-gold { border-color: var(--gold); background: var(--gold-bg); }
.callout .label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}
.callout-info .label { color: var(--blue); }
.callout-warn .label { color: var(--red); }
.callout-tip .label { color: var(--green-bright); }
.callout-gold .label { color: var(--gold); }
.callout p { font-size: 15px; color: var(--ink); line-height: 1.6; }

/* ============ FOOTER ============ */
.footer {
  margin-top: 80px;
  background: var(--navy-deep);
  color: var(--cream);
  padding: 64px 0 32px;
}
.footer .container { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; }
.footer .col h4 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 16px;
}
.footer .col ul { list-style: none; }
.footer .col li { margin-bottom: 10px; }
.footer .col a {
  color: rgba(251, 248, 241, 0.7);
  font-size: 14px;
  transition: color 0.15s;
}
.footer .col a:hover { color: var(--cream); }
.footer .promise {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--cream);
  font-style: italic;
  margin-bottom: 16px;
  line-height: 1.45;
}
.footer .brand-block { margin-bottom: 20px; }
.footer .brand-block .brand-name { color: var(--cream); }
.footer-bottom {
  border-top: 1px solid rgba(251,248,241,0.1);
  margin-top: 48px;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(251,248,241,0.5);
  font-family: var(--mono);
  letter-spacing: 0.05em;
}
@media (max-width: 760px) {
  .footer .container { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 8px; }
}
@media (max-width: 480px) {
  .footer .container { grid-template-columns: 1fr; }
}

/* ============ FORMS ============ */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.field select,
.field input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--sans);
  font-size: 15px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--navy-deep);
  border-radius: 4px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230A2540' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
}
.field select:focus,
.field input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.08);
}

/* ============ DATA TABLE — financial document style ============ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.data-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.data-table th.r { text-align: right; }
.data-table td {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink);
}
.data-table td.r {
  text-align: right;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--navy-deep);
}
.data-table tr.subtotal td {
  background: var(--cream-deep);
  font-weight: 600;
  color: var(--navy-deep);
  padding: 14px 12px;
  border-bottom: 1px solid var(--line-strong);
}
.data-table tr.subtotal td:last-child { font-family: var(--mono); }
.data-table tr.total td {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--navy-deep);
  border-top: 2px solid var(--rule);
  border-bottom: none;
  padding: 24px 12px;
  background: var(--cream);
  letter-spacing: -0.01em;
}
.data-table tr.total td:last-child { font-family: var(--serif); }

/* ============ PRINT ============ */
@media print {
  .nav, .footer, .nav-cta, .btn { display: none !important; }
  body { background: white; }
  .card, .panel { border: 1px solid #999; page-break-inside: avoid; }
}

/* ============ MOTION (subtle) ============ */
@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    animation: fadeUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
