/* ============================================================
   ContextIQ — Context-Based Knowledge Intelligence
   Dark navy aesthetic (harmonised with Paper III + Sandeep storefront)
   Re-themed 2026-04-30. HTML structure unchanged from light version.
   ============================================================ */

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

/* ── Design Tokens (canonical dark) ── */
:root {
  /* Palette — same as Paper III + Sandeep storefront */
  --navy:        #0f2044;
  --navy-mid:    #1a3060;
  --navy-light:  #1e3a5f;
  --navy-deep:   #0a1730;
  --gold:        #d4a017;
  --gold-light:  #e8b830;
  --gold-soft:   rgba(212, 160, 23, 0.18);
  --teal:        #0e6b60;
  --teal-light:  #1a8a7a;
  --teal-soft:   rgba(14, 107, 96, 0.20);
  --purple:      #4a2080;
  --purple-light:#6a35a8;
  --purple-soft: rgba(74, 32, 128, 0.22);
  --white:       #ffffff;
  --off-white:   #f7f8fa;

  /* Text — light-on-navy (was dark-on-white) */
  --text:        #c8d8e8;        /* primary body */
  --text-strong: #ffffff;        /* H1-H5 */
  --text-muted:  #8ea1b8;        /* eyebrows, captions, references */
  --text-soft:   #6a7a8a;        /* tertiary */

  /* Surfaces */
  --surface-1:   rgba(255,255,255,0.04);   /* default panel */
  --surface-2:   rgba(255,255,255,0.06);   /* alt section */
  --surface-3:   rgba(255,255,255,0.08);   /* stat / cards */
  --surface-4:   rgba(255,255,255,0.10);   /* hover */
  --border:      rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);
  --border-gold: rgba(212, 160, 23, 0.32);

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

  /* Fluid type scale (unchanged from light version) */
  --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 (unchanged) */
  --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:   14px;
  --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);
  /* Same gradient as Sandeep storefront — premium, layered, on-brand */
  background:
    radial-gradient(circle at 8% 0%, rgba(74, 32, 128, 0.30) 0, transparent 38rem),
    radial-gradient(circle at 100% 0%, rgba(14, 107, 96, 0.24) 0, transparent 36rem),
    radial-gradient(circle at 50% 100%, rgba(212, 160, 23, 0.08) 0, transparent 40rem),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}

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

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

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

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

ul, ol {
  padding-left: 1.5em;
  color: var(--text);
}

li {
  color: var(--text);
}

/* ── 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: rgba(10, 23, 48, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: var(--space-sm) var(--side-pad);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-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.18em;
  text-transform: uppercase;
}

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

/* ── Cover Section ── */
.cover {
  background: transparent;             /* body gradient shows through */
  color: var(--white);
  padding: var(--space-2xl) var(--side-pad);
  min-height: 70vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.cover::before {
  /* Subtle accent glow behind the cover content */
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 35%, rgba(212, 160, 23, 0.10) 0, transparent 24rem),
    radial-gradient(circle at 85% 60%, rgba(106, 53, 168, 0.14) 0, transparent 26rem);
  z-index: 0;
  pointer-events: none;
}

.cover-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.badge {
  display: inline-block;
  background: var(--gold-soft);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.4em 0.9em;
  border-radius: 999px;
  margin-bottom: var(--space-md);
}

.cover-eyebrow {
  color: var(--text-muted);
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
  font-weight: 700;
}

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

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

.cover-quote {
  border-left: 3px solid var(--gold);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--text);
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 var(--radius) var(--radius) 0;
}

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

.author-card {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
  display: inline-block;
  margin-top: var(--space-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

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

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

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

/* ── Table of Contents ── */
.toc {
  background: rgba(26, 48, 96, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: var(--space-xl) var(--side-pad);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

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

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

.toc-list li {
  counter-increment: toc-counter;
  border-bottom: 1px solid var(--border);
  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-light);
  font-size: var(--text-xs);
  font-weight: 800;
  min-width: 2em;
  flex-shrink: 0;
  letter-spacing: 0.06em;
}

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

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

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

/* "section-alt" was off-white; now a slightly more saturated panel */
.section-alt {
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

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

.section-title {
  font-size: var(--text-3xl);
  color: var(--white);
  margin-bottom: var(--space-xs);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.title-rule {
  width: 3rem;
  height: 3px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-light) 100%);
  margin-bottom: var(--space-lg);
  border-radius: 2px;
}

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

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

/* ── 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(--surface-3);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold);
}

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

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

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

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

/* ── Pull Quotes / Blockquotes ── */
.pull-quote {
  border-left: 4px solid var(--gold);
  background: var(--gold-soft);
  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(--white);
  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);
}

.content-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--gold-light);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(232, 184, 48, 0.5);
}

/* ── Figures ── */
.figure {
  margin: var(--space-xl) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.40);
  border: 1px solid var(--border);
  background: var(--surface-1);
}

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

figcaption {
  background: var(--surface-2);
  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(--white);
  font-style: normal;
}

/* ── Capability Cards (already dark in original — refined) ── */
.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);
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.capability-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.08) 0, transparent 60%);
  pointer-events: none;
}

.capability-navy {
  background: linear-gradient(135deg, var(--navy-mid) 0%, var(--navy) 100%);
}

.capability-teal {
  background: linear-gradient(135deg, var(--teal) 0%, #0a4f47 100%);
}

.capability-purple {
  background: linear-gradient(135deg, var(--purple) 0%, #361659 100%);
}

.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.22);
  padding-bottom: var(--space-xs);
  letter-spacing: -0.015em;
  position: relative;
  z-index: 1;
}

.capability-card p {
  color: rgba(255, 255, 255, 0.90);
  font-size: var(--text-sm);
  line-height: 1.7;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
}

/* ── Conclusion Box ── */
.conclusion-box {
  background: linear-gradient(135deg, var(--navy-mid) 0%, var(--navy-deep) 100%);
  color: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-gold);
  padding: var(--space-xl);
  margin: var(--space-xl) 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.40);
  position: relative;
  overflow: hidden;
}

.conclusion-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 100%, rgba(212, 160, 23, 0.12) 0, transparent 60%);
  pointer-events: none;
}

.conclusion-box p {
  color: rgba(255, 255, 255, 0.92);
  font-size: var(--text-lg);
  line-height: 1.7;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
}

.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-light);
}

/* ── 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);
  line-height: 1.7;
}

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

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

/* ── Site Footer ── */
.site-footer {
  background: rgba(10, 23, 48, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-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);
  letter-spacing: 0.04em;
}

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

/* ── Tables (if used in body) ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: var(--text-sm);
  background: var(--surface-1);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

th {
  background: var(--surface-2);
  color: var(--white);
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Inline emphasis ── */
strong, b {
  color: var(--white);
  font-weight: 700;
}

em, i {
  color: var(--text);
}

code, pre {
  font-family: 'SF Mono', Monaco, 'Cascadia Mono', 'Roboto Mono', monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--gold-light);
}

pre {
  padding: var(--space-md);
  overflow-x: auto;
  margin: var(--space-md) 0;
  line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; }

hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: var(--space-xl) 0;
}

/* ── Selection ── */
::selection {
  background: var(--gold);
  color: var(--navy);
}

/* ── Scrollbar (webkit, optional refinement) ── */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--navy-deep); }
::-webkit-scrollbar-thumb { background: var(--navy-mid); border-radius: 6px; border: 3px solid var(--navy-deep); }
::-webkit-scrollbar-thumb:hover { background: var(--navy-light); }

/* ── 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);
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ── Print Styles (invert to light for paper) ── */
@media print {
  .site-header,
  .toc {
    display: none;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }

  h1, h2, h3, h4, h5 { color: #0f2044 !important; }
  p, li { color: #1a1a2e !important; }
  a { color: #000 !important; text-decoration: none; }

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

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

  .cover-title,
  .cover-subtitle,
  .cover-eyebrow,
  .cover-quote,
  .cover-quote p { color: #000 !important; }

  .stat-card,
  .author-card,
  .pull-quote,
  .conclusion-box,
  .capability-card { background: #f7f8fa !important; color: #1a1a2e !important; border: 1px solid #dde3ec !important; }

  .stat-value, .capability-title { color: #0f2044 !important; }

  .footer-sub, .author-role, figcaption { color: #6a7a8a !important; }

  strong, b { color: #0f2044 !important; }
}
