/* ============================================================
   ContextIQ — Context-Based Knowledge Intelligence
   External Stylesheet — No inline styles
   Mobile-first responsive design
   ============================================================ */

/* ── Reset & Box Model ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design Tokens ── */
:root {
  --navy:        #0f2044;
  --navy-mid:    #1a3060;
  --navy-light:  #1e3a5f;
  --gold:        #d4a017;
  --gold-light:  #e8b830;
  --teal:        #0e6b60;
  --teal-light:  #1a8a7a;
  --purple:      #4a2080;
  --purple-light:#5a30a0;
  --white:       #ffffff;
  --off-white:   #f7f8fa;
  --text-dark:   #1a1a2e;
  --text-mid:    #3a3a5a;
  --text-muted:  #6a7a8a;
  --border:      #dde3ec;

  --font-sans:   'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-serif:  Georgia, 'Times New Roman', serif;

  /* Fluid type scale */
  --text-xs:     clamp(0.75rem,  1.5vw, 0.85rem);
  --text-sm:     clamp(0.875rem, 2vw,   1rem);
  --text-base:   clamp(1rem,     2.5vw, 1.125rem);
  --text-lg:     clamp(1.125rem, 3vw,   1.375rem);
  --text-xl:     clamp(1.25rem,  3.5vw, 1.625rem);
  --text-2xl:    clamp(1.5rem,   4vw,   2rem);
  --text-3xl:    clamp(1.875rem, 5vw,   2.5rem);
  --text-4xl:    clamp(2.25rem,  6vw,   3.25rem);

  /* Spacing */
  --space-xs:    clamp(0.5rem,   1.5vw, 0.75rem);
  --space-sm:    clamp(0.75rem,  2vw,   1rem);
  --space-md:    clamp(1rem,     3vw,   1.5rem);
  --space-lg:    clamp(1.5rem,   4vw,   2.5rem);
  --space-xl:    clamp(2rem,     5vw,   3.5rem);
  --space-2xl:   clamp(3rem,     7vw,   5rem);

  --radius:      8px;
  --radius-lg:   12px;
  --max-width:   780px;
  --side-pad:    clamp(1.25rem, 5vw, 2.5rem);
}

/* ── Base Typography ── */
html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--text-dark);
  background: var(--white);
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
}

p {
  margin-bottom: var(--space-md);
  font-size: var(--text-base);
  color: var(--text-mid);
  line-height: 1.8;
}

a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--gold-light);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  padding-left: 1.5em;
}

/* ── Layout Utilities ── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--side-pad);
  padding-right: var(--side-pad);
}

/* ── Site Header ── */
.site-header {
  background: var(--navy);
  padding: var(--space-sm) var(--side-pad);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--gold);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  color: var(--white);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-label {
  color: var(--gold);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* ── Cover Section ── */
.cover {
  background: var(--navy);
  color: var(--white);
  padding: var(--space-2xl) var(--side-pad);
  min-height: 70vh;
  display: flex;
  align-items: center;
}

.cover-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

.badge {
  display: inline-block;
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3em 0.8em;
  border-radius: 4px;
  margin-bottom: var(--space-md);
}

.cover-eyebrow {
  color: var(--text-muted);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
  color: #8ab4c8;
}

.cover-title {
  font-size: var(--text-4xl);
  color: var(--white);
  line-height: 1.1;
  margin-bottom: var(--space-md);
  font-weight: 800;
}

.cover-subtitle {
  font-size: var(--text-lg);
  color: var(--gold);
  font-style: italic;
  margin-bottom: var(--space-lg);
}

.cover-quote {
  border-left: 4px solid var(--gold);
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
  font-size: var(--text-lg);
  font-style: italic;
  color: #c8d8e8;
  line-height: 1.7;
}

.cover-quote p {
  color: #c8d8e8;
  font-size: var(--text-lg);
  margin-bottom: 0;
}

.author-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
  display: inline-block;
  margin-top: var(--space-lg);
}

.author-name {
  color: var(--white);
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.author-role {
  color: #8ab4c8;
  font-size: var(--text-sm);
  margin-bottom: 0;
}

.author-role a {
  color: var(--gold);
}

/* ── Table of Contents ── */
.toc {
  background: var(--navy-mid);
  padding: var(--space-xl) var(--side-pad);
  border-bottom: 1px solid var(--navy-light);
}

.toc-title {
  color: var(--gold);
  font-size: var(--text-xl);
  margin-bottom: var(--space-md);
}

.toc-list {
  list-style: none;
  padding: 0;
  counter-reset: toc-counter;
}

.toc-list li {
  counter-increment: toc-counter;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: var(--space-xs) 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.toc-list li::before {
  content: counter(toc-counter, decimal-leading-zero);
  color: var(--gold);
  font-size: var(--text-xs);
  font-weight: 700;
  min-width: 2em;
  flex-shrink: 0;
}

.toc-list a {
  color: #c8d8e8;
  text-decoration: none;
  font-size: var(--text-base);
  transition: color 0.2s;
}

.toc-list a:hover {
  color: var(--gold);
}

/* ── Sections ── */
.section {
  padding: var(--space-2xl) 0;
}

.section-alt {
  background: var(--off-white);
}

.section-eyebrow {
  display: block;
  color: var(--gold);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.section-title {
  font-size: var(--text-3xl);
  color: var(--navy);
  margin-bottom: var(--space-xs);
  line-height: 1.15;
}

.title-rule {
  width: 3rem;
  height: 3px;
  background: var(--gold);
  margin-bottom: var(--space-lg);
  border-radius: 2px;
}

.subsection {
  margin-top: var(--space-xl);
}

.subsection-title {
  font-size: var(--text-xl);
  color: var(--gold);
  margin-bottom: var(--space-sm);
  font-weight: 700;
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: var(--space-md);
  text-align: center;
}

.section-alt .stat-card {
  background: var(--white);
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.25rem;
  line-height: 1;
}

.stat-symbol {
  font-size: var(--text-3xl);
}

.stat-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* ── Pull Quotes / Blockquotes ── */
.pull-quote {
  border-left: 4px solid var(--gold);
  background: #f0f4fa;
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-xl) 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.pull-quote p {
  font-size: var(--text-lg);
  font-style: italic;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0;
  line-height: 1.6;
}

/* ── Content Lists ── */
.content-list {
  list-style: none;
  padding: 0;
  margin: var(--space-md) 0 var(--space-lg);
}

.content-list li {
  position: relative;
  padding: var(--space-xs) 0 var(--space-xs) 1.5em;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
  color: var(--text-mid);
}

.content-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
}

/* ── Figures ── */
.figure {
  margin: var(--space-xl) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(15,32,68,0.12);
  border: 1px solid var(--border);
}

.figure img {
  width: 100%;
  height: auto;
  display: block;
}

figcaption {
  background: var(--off-white);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
  border-top: 1px solid var(--border);
}

figcaption strong {
  color: var(--navy);
  font-style: normal;
}

/* ── Capability Cards ── */
.capability-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.capability-card {
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  color: var(--white);
}

.capability-navy {
  background: var(--navy);
}

.capability-teal {
  background: var(--teal);
}

.capability-purple {
  background: var(--purple);
}

.capability-title {
  font-size: var(--text-lg);
  color: var(--white);
  margin-bottom: var(--space-sm);
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: var(--space-xs);
}

.capability-card p {
  color: rgba(255,255,255,0.88);
  font-size: var(--text-sm);
  line-height: 1.7;
  margin-bottom: 0;
}

/* ── Conclusion Box ── */
.conclusion-box {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-xl) 0;
}

.conclusion-box p {
  color: rgba(255,255,255,0.9);
  font-size: var(--text-lg);
  line-height: 1.7;
  margin-bottom: 0;
}

.conclusion-attribution {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  margin-top: var(--space-lg);
}

.conclusion-attribution a {
  color: var(--gold);
}

/* ── References ── */
.references-list {
  list-style: none;
  padding: 0;
  counter-reset: ref-counter;
}

.references-list li {
  counter-increment: ref-counter;
  position: relative;
  padding: var(--space-md) 0 var(--space-md) 2.5em;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-mid);
  line-height: 1.7;
}

.references-list li::before {
  content: '[' counter(ref-counter) ']';
  position: absolute;
  left: 0;
  top: var(--space-md);
  color: var(--gold);
  font-weight: 700;
  font-size: var(--text-sm);
}

.references-list a {
  color: var(--gold);
  word-break: break-all;
}

/* ── Site Footer ── */
.site-footer {
  background: var(--navy);
  border-top: 4px solid var(--gold);
  padding: var(--space-xl) var(--side-pad);
  text-align: center;
}

.footer-brand {
  color: var(--white);
  font-size: var(--text-xl);
  font-weight: 800;
  margin-bottom: var(--space-xs);
}

.footer-sub {
  color: #8ab4c8;
  font-size: var(--text-sm);
  margin-bottom: 0;
}

/* ── Responsive: Tablet (≥600px) ── */
@media (min-width: 600px) {
  .capability-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Responsive: Desktop (≥900px) ── */
@media (min-width: 900px) {
  .cover {
    min-height: 80vh;
    padding: var(--space-2xl) var(--side-pad);
  }
}

/* ── Print Styles ── */
@media print {
  .site-header,
  .toc {
    display: none;
  }

  .section {
    page-break-inside: avoid;
  }

  .figure {
    page-break-inside: avoid;
  }

  body {
    font-size: 11pt;
    color: #000;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .cover {
    background: #fff;
    color: #000;
    min-height: auto;
  }

  .cover-title,
  .cover-subtitle,
  .cover-eyebrow {
    color: #000;
  }
}
