/* ═══════════════════════════════════════════════════════════════
   JIL DOC STANDARD V16 - Clean institutional styling for /docs pages
   Shared CSS: link from <head> instead of embedding per-page.
   ═══════════════════════════════════════════════════════════════ */

/* --- Variables --- */
:root {
  --bg:          #FAFAF8;
  --text:        #1C1C1E;
  --muted:       #6E6E73;
  --line:        #DCDCD8;
  --border:      #DCDCD8;
  --gold:        #D4AF37;
  --accent:      #2A6BFF;
  --accent-dark: #1E5AE6;
  --surface:     #F0F0EC;
  --shadow:      0 4px 12px rgba(0,0,0,.04);
  --glow:        none;
  --navy:        #111113;
  --navy-mid:    #1C1C1E;
  --navy-light:  #3A3A3C;
  --gold-light:  #E8C94A;
  --white:       #F5F5F5;
  --off-white:   #F0F0EC;
  --gray-100:    #F0F0EC;
  --gray-300:    #D1D1D6;
  --gray-500:    #6E6E73;
  --gray-700:    #3A3A3C;
}

/* --- Reset & Base --- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  padding-top: 64px;
  font-family: 'Helvetica Neue', Helvetica, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.72;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* --- Page Wrapper (all variants) --- */
.page-wrapper, .pw, .wrap, .container { max-width: 1080px; margin: 0 auto; padding: 0 64px 60px; }

/* --- Fallback body margins for pages without a wrapper div --- */
body > section,
body > div:not(.page-wrapper):not(.pw):not(.wrap):not(.container):not([id="siteHeader"]),
body > h1, body > h2, body > h3, body > p, body > ul, body > ol, body > table,
body > .callout, body > .grid-2, body > .grid-3, body > .grid-4,
body > .table-wrap, body > .stat-box, body > .card {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 64px;
  padding-right: 64px;
}
@media (max-width: 768px) {
  .page-wrapper, .pw, .wrap, .container { padding: 0 24px 40px !important; }
  body > section,
  body > div:not(.page-wrapper):not(.pw):not(.wrap):not(.container):not([id="siteHeader"]),
  body > h1, body > h2, body > h3, body > p, body > ul, body > ol, body > table,
  body > .callout, body > .grid-2, body > .grid-3, body > .grid-4,
  body > .table-wrap, body > .stat-box, body > .card {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* --- Hero --- */
.hero { text-align: center; padding: 80px 0 60px; position: relative; }
.hero::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 120px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hero-badge,
.badge {
  display: inline-block;
  font-family: 'Helvetica Neue', Helvetica, monospace;
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(212,175,55,0.25);
  padding: 6px 18px; border-radius: 20px; margin-bottom: 28px;
  background: rgba(212,175,55,0.06);
}
.hero h1 {
  font-size: clamp(36px, 5vw, 52px);
  color: var(--text);
  font-weight: 500; line-height: 1.15; margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.hero h1 span { color: var(--gold); }
.hero h1 em {
  font-style: normal;
  color: var(--gold);
}
.hero-sub {
  font-size: 17px; color: var(--muted); font-weight: 400;
  max-width: 580px; margin: 0 auto 24px;
}
.hero-meta,
.meta {
  font-family: 'Helvetica Neue', Helvetica, monospace;
  font-size: 11px; color: var(--muted); letter-spacing: 1px;
}

/* --- Sections --- */
section { padding: 56px 0; }
section + section { border-top: 1px solid var(--line); }

/* Eyebrow / title pattern */
.section-eyebrow {
  font-size: 0.75rem; font-weight: 600; color: var(--gold);
  text-transform: uppercase; letter-spacing: 2.5px; margin-bottom: 0.8rem;
}
.section-title {
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  font-weight: 500; color: var(--text);
  margin-bottom: 1rem; line-height: 1.2;
  letter-spacing: -0.015em;
}
.section-desc {
  font-size: 1.1rem; color: var(--gray-500);
  max-width: 650px; margin-bottom: 3.5rem;
}

/* --- Typography --- */
h2 {
  font-size: 28px; color: var(--text); font-weight: 500;
  margin-bottom: 24px; line-height: 1.25;
}
h2 .num, h2 .n {
  color: var(--gold);
  font-size: 14px; font-weight: 500; letter-spacing: 1px;
  display: block; margin-bottom: 8px;
}
h3 { font-size: 18px; font-weight: 600; color: var(--text); margin: 36px 0 14px; }
h4 { font-size: 16px; font-weight: 600; color: var(--text); margin: 24px 0 12px; }
p  { margin-bottom: 18px; color: var(--text); }
ul, ol { margin: 0 0 18px 24px; color: var(--text); }
li { margin-bottom: 8px; }
a  { color: var(--accent); text-decoration: underline; }
a:hover { color: var(--gold); }

/* --- Code --- */
code {
  font-family: 'SF Mono', 'Menlo', monospace; font-size: 13px;
  background: var(--off-white); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 4px; color: var(--text);
}
pre {
  background: var(--off-white); color: var(--text);
  padding: 20px; border-radius: 8px; overflow-x: auto;
  margin: 20px 0; font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 13px; line-height: 1.6;
  border: 1px solid var(--border);
}
pre code { background: none; border: none; padding: 0; color: inherit; }

/* --- Callouts --- */
.callout, .co {
  background: rgba(42,107,255,0.04); border-left: 3px solid var(--accent);
  padding: 24px 28px; border-radius: 0 8px 8px 0;
  margin: 28px 0; font-size: 15px; line-height: 1.8;
}
.callout strong, .co strong { color: var(--accent); }
.callout.gold, .co.gold { background: rgba(212,175,55,0.06); border-left-color: var(--gold); }
.callout.gold strong, .co.gold strong { color: var(--gold); }

/* --- Tables --- */
.table-wrap, .tw {
  overflow-x: auto; margin: 24px 0; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--off-white); color: var(--text); font-weight: 600;
  text-align: left; padding: 14px 16px;
  font-size: 12px; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
}
tbody td {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  vertical-align: top; background: var(--white);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--off-white); }
td.label, td.l { font-weight: 600; color: var(--text); white-space: nowrap; }

/* --- Cards / Grids --- */
.grid-2, .cap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 24px 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 24px 0; }
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 24px 0; }

.cap-card, .input-card, .card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 20px;
  box-shadow: var(--shadow);
}
.cap-card h4, .input-card h4, .card h4 { font-size: 14px; color: var(--text); margin-bottom: 8px; font-weight: 700; }
.cap-card p, .input-card p, .card p   { font-size: 14px; margin-bottom: 0; color: var(--muted); }

.stat-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 20px; text-align: center;
}
.stat-box .stat-value {
  font-size: 2rem; font-weight: 300; color: var(--text);
}
.stat-box .stat-label {
  font-size: 0.8rem; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600;
}

/* --- Phases / Steps --- */
.phases { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0; }
.phase-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 24px;
  box-shadow: var(--shadow);
}
.phase-card .phase-label {
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold); margin-bottom: 6px;
}
.phase-card .phase-time { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.phase-card h4 { font-size: 16px; color: var(--text); margin-bottom: 10px; }
.phase-card p  { font-size: 14px; margin-bottom: 0; color: var(--muted); }

/* --- Override Items --- */
.override-list { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.override-item {
  flex: 1; min-width: 140px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 16px; text-align: center;
  box-shadow: var(--shadow);
}
.override-item .icon { font-size: 24px; margin-bottom: 6px; }
.override-item h4 { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.override-item p  { font-size: 12px; color: var(--muted); margin-bottom: 0; }

/* --- Chat Bubbles --- */
.chat-demo { margin: 24px 0; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 80%; padding: 16px 20px; border-radius: 16px; font-size: 14px; line-height: 1.7; }
.bubble-agent {
  background: rgba(42,107,255,0.04); border: 1px solid rgba(42,107,255,0.12);
  align-self: flex-start; border-bottom-left-radius: 4px;
}
.bubble-agent .bubble-label {
  font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px;
}
.bubble-user {
  background: var(--surface); border: 1px solid var(--border);
  align-self: flex-end; border-bottom-right-radius: 4px; color: var(--text);
}
.bubble-user .bubble-label {
  font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase; color: var(--gold); margin-bottom: 6px;
}

/* --- Q&A --- */
.question {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 20px 24px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.question .q-num { font-size: 12px; color: var(--gold); font-weight: 600; margin-bottom: 4px; }
.question .q-title { font-weight: 600; color: var(--text); margin-bottom: 6px; }
.question .q-detail { font-size: 14px; color: var(--muted); margin-bottom: 0; }

/* --- Next Steps --- */
.next-steps { list-style: none; padding: 0; margin: 20px 0; }
.next-steps li {
  padding: 12px 0 12px 20px; border-left: 2px solid var(--gold);
  margin-bottom: 8px; margin-left: 8px;
}
.next-steps li strong { color: var(--text); }

/* --- Scenarios --- */
.scenario {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 24px; margin-bottom: 16px;
}
.scenario h4 { color: var(--text); margin-bottom: 12px; }
.scenario .row { padding: 6px 0; font-size: 14px; }
.scenario .label { color: var(--gold); font-weight: 600; }
.scenario .val { color: var(--muted); }
.scenario .result {
  margin-top: 12px; padding: 12px; border-radius: 6px;
  background: rgba(42,107,255,0.04); font-weight: 600; color: var(--accent);
}

/* --- Flow Grid --- */
.flow-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px;
  align-items: center; margin: 24px 0;
}
.flow-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 20px;
}
.flow-box h4 { color: var(--text); margin-bottom: 8px; }
.flow-box p  { color: var(--muted); margin-bottom: 0; font-size: 14px; }
.flow-arrow { font-size: 24px; color: var(--gold); text-align: center; }

/* --- Doc Footer (legacy) --- */
.doc-footer {
  text-align: center; padding: 48px 0;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.doc-footer .logo-text {
  font-size: 20px; color: var(--text); margin-bottom: 8px; font-weight: 500;
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero { animation: fadeUp .6s ease-out; }

/* --- Print --- */
@media print {
  body { background: #fff; color: #000; padding-top: 0; }
  .hero { padding: 40px 0 30px; }
  .hero h1 { color: #1C1C1E; }
  h2 { color: #1C1C1E; }
  h3, h4 { color: #1C1C1E; }
  h2 .num, h2 .n, .hero-badge, .badge, .phase-card .phase-label, .question .q-num, code { color: #1C1C1E; }
  pre { background: #f0f0f0; color: #333; }
  a { color: #1C1C1E; }
  .doc-footer .logo-text { color: #1C1C1E; }
  .callout, .co { background: #f8f8f8; border-left-color: #1C1C1E; }
  table thead th { background: #f0f0f0; color: #1C1C1E; }
  tbody td { background: #fff; }
}

/* --- Responsive --- */
@media (max-width: 968px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .phases { grid-template-columns: 1fr; }
  .flow-grid { grid-template-columns: 1fr; }
  .flow-arrow { transform: rotate(90deg); text-align: center; }
}
@media (max-width: 768px) {
  .page-wrapper { padding: 0 24px 40px; }
  .hero { padding: 50px 0 40px; }
  .grid-2, .cap-grid, .input-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .override-list { flex-direction: column; }
}
@media (max-width: 480px) {
  .page-wrapper { padding: 0 18px 40px; }
  .hero { padding: 40px 0 30px; }
  .hero h1 { font-size: 28px; }
}
