/* The AI Native Leader — web edition theme */
:root {
  --navy: #0D0F1C;
  --amber: #D09D64;
  --paper: #ffffff;  
  --ink: #1d2333;
  --muted: #5c6274;
  --line: #e3ded4;
  --card: #ffffff;
  --accent: #d99a01;          /* accessible amber for text/links on light */
  --sidebar-bg: #0D0F1C;
  --sidebar-ink: #d6dcf0;
  --sidebar-muted: #8b94b8;
  --code-bg: #f1ede4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12141c;
    --ink: #e6e4de;
    --muted: #9aa0b3;
    --line: #2a2e40;
    --card: #1a1d29;
    --accent: #ffb84d;
    --sidebar-bg: #0D0F1C;
    --code-bg: #20242f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 .98rem/1.75 Verdana, Geneva, "DejaVu Sans", sans-serif;
}

.layout { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
#sidebar {
  width: 400px; flex-shrink: 0;
  background: var(--sidebar-bg); color: var(--sidebar-ink);
  padding: 1.4rem 1.2rem 3rem;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: .88rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.home-link {
  display: block; color: #fff; text-decoration: none;
  font-weight: 700; font-size: 1.05rem; margin-bottom: 1rem;
  border-bottom: 2px solid var(--amber); padding-bottom: .8rem;
}
.nav-part {
  margin: 1.2rem 0 .3rem; text-transform: uppercase; letter-spacing: .08em;
  font-size: .72rem; color: var(--amber); font-weight: 700;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list li { margin: 0; }
.nav-list a {
  display: block; color: var(--sidebar-ink); text-decoration: none;
  padding: .28rem .5rem; border-radius: 6px; line-height: 1.4;
}
.nav-list a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-list li.active a { background: rgba(255,153,0,.18); color: #fff; font-weight: 600; }

.search-box { position: relative; margin-bottom: .4rem; }
#search {
  width: 100%; padding: .45rem .6rem; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08);
  color: #fff; font-size: .85rem;
}
#search::placeholder { color: var(--sidebar-muted); }
#search-results { position: absolute; z-index: 30; left: 0; right: 0; top: 2.4rem;
  background: var(--card); color: var(--ink); border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35); max-height: 60vh; overflow-y: auto; }
#search-results a { display: block; padding: .5rem .7rem; text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--line); font-size: .84rem; }
#search-results a:hover { background: rgba(255,153,0,.12); }
#search-results .snippet { color: var(--muted); font-size: .78rem; display: block;
  margin-top: .25rem; line-height: 1.5; }
#search-results mark { background: rgba(255,153,0,.4); color: inherit; padding: 0 .12em; border-radius: 3px; }
#search-results .no-hits { padding: .6rem .7rem; font-size: .84rem; color: var(--muted); }

#nav-toggle {
  display: none; position: fixed; z-index: 50; top: .7rem; left: .7rem;
  font-size: 1.1rem; padding: .35rem .6rem; border-radius: 8px; border: none;
  background: var(--navy); color: #fff; cursor: pointer;
}

/* ---------- toolkit dropdown (sidebar) ---------- */
.nav-tools {
  margin: .6rem 0 .2rem; border: 1px solid rgba(255,153,0,.35);
  border-radius: 8px; background: rgba(255,153,0,.07);
}
.nav-tools summary {
  cursor: pointer; padding: .45rem .6rem; font-weight: 700;
  color: var(--amber); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  list-style-position: inside;
}
.nav-tools summary:hover { color: #fff; }
.nav-tools ul { padding: 0 .3rem .4rem; }
.tool-home { font-size: .88rem; color: var(--muted); }

/* ---------- main content ---------- */
main { flex: 1; min-width: 0; }
.chapter {
  max-width: 58rem; margin: 0 auto; padding: 3.2rem 1.6rem 2rem;
}
.chapter > p:first-child strong {  /* CHAPTER N kicker */
  color: var(--accent); letter-spacing: .18em; font-size: .85rem;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: uppercase;
}
h1 {
  font-size: 2.1rem; line-height: 1.15; margin: .4rem 0 1.4rem;
  color: var(--ink); letter-spacing: .01em;
  margin-top: 3rem;
}
h2 {
  font-size: 1.5rem; margin: 2.4rem 0 .8rem;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .06em; color: var(--accent);
  margin-top: 3rem;
}
h3 { font-size: 1.06rem; margin: 1.8rem 0 .6rem;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif; 
  margin-top: 2rem;
}
a { color: var(--accent); }
blockquote {
  margin: 1.4rem 0; padding: .2rem 1.2rem;
  border-left: 3px solid var(--amber); color: var(--muted); font-style: italic;
}
hr { border: none; border-top: 1px solid var(--line); margin: 2.5rem 0; }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; font-size: .88em; }
img { max-width: 100%; }

table {
  border-collapse: collapse; width: 100%; margin: 1.4rem 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif; font-size: .88rem; line-height: 1.5;
  display: block; overflow-x: auto;
}
th, td { border: 1px solid var(--line); padding: .55rem .7rem; text-align: left; vertical-align: top; }
th { background: var(--code-bg); }

.pagers {
  max-width: 58rem; margin: 0 auto; padding: 0 1.6rem 4rem;
  display: flex; justify-content: space-between; gap: 1rem;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif; font-size: .9rem;
}
.pager { text-decoration: none; padding: .6rem .9rem; border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); background: var(--card); max-width: 48%; }
.pager:hover { border-color: var(--amber); }

/* ---------- chapter-opening quotes ---------- */
.chapter-quote {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12pt;
  width: 80%;
  margin: 1.4rem auto 2rem;
  padding: .9rem 1.4rem;
  border-left: 3px solid var(--accent);
  background: var(--card);
  border-radius: 0 10px 10px 0;
  color: var(--ink);
  line-height: 1.7;
  text-align: center;
}
.chapter-quote .attribution {
  display: block;
  margin-top: .5rem;
  font-size: 10.5pt;
  font-style: italic;
  opacity: .75;
  text-align: center;
}
.chapter-quote p { margin: .3rem 0; }

/* ---------- callouts ---------- */
.callout {
  margin: 1.6rem 0; padding: 1rem 1.2rem;
  background: var(--card); border: 1px solid var(--line);
  border-left: 5px solid var(--amber); border-radius: 10px;
  font-size: .95em;
  box-shadow: 0 2px 8px rgba(15,23,63,.05);
}
.callout > p:first-child { margin-top: 0; }
.callout > p:last-child, .callout > ul:last-child { margin-bottom: 0; }
.callout.brief {
  border-left-color: var(--navy);
  background: linear-gradient(0deg, rgba(15,23,63,.045), rgba(15,23,63,.045)), var(--card);
}
.callout.brief ul li {
  font-size: .75rem;
}
@media (prefers-color-scheme: dark) {
  .callout.brief { background: linear-gradient(0deg, rgba(255,153,0,.05), rgba(255,153,0,.05)), var(--card); }
}
.callout.brief > p:first-child strong {
  color: var(--accent); letter-spacing: .12em; font-size: .8rem; text-transform: uppercase;
}

/* ---------- interactive tools ---------- */
.tool-embed {
  margin: 1.8rem 0; padding: 1.2rem 1.3rem 1.4rem;
  background: var(--card); border: 1px solid var(--line);
  border-top: 4px solid var(--amber); border-radius: 12px;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif; font-size: .92rem;
  box-shadow: 0 2px 10px rgba(15,23,63,.06);
}
.tool-embed h4 { margin: 0 0 .2rem; font-size: 1rem; color: var(--ink); }
.tool-embed .tool-sub { color: var(--muted); font-size: .82rem; margin: 0 0 .9rem; }
.tool-embed label { display: block; font-size: .84rem; font-weight: 600; margin: .6rem 0 .15rem; }
.tool-embed input[type=text], .tool-embed input[type=number], .tool-embed textarea, .tool-embed select {
  width: 100%; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); font-size: .9rem;
}
.tool-embed input[type=range] { width: 100%; accent-color: var(--amber); }
.tool-embed button, .btn {
  display: inline-block; margin-top: .8rem; padding: .5rem 1rem; border: none;
  border-radius: 8px; background: var(--navy); color: #fff; font-weight: 600;
  cursor: pointer; text-decoration: none; font-size: .9rem;
}
.tool-embed button:hover, .btn:hover { background: #1c2960; }
.btn.primary { background: var(--accent); color: #21170a; }
.btn.primary:hover { background: #ffb84d; }
.tool-result {
  margin-top: 1rem; padding: .8rem 1rem; border-radius: 8px;
  background: var(--code-bg); font-size: .9rem;
}
.tool-result.good { border-left: 4px solid #2e8540; }
.tool-result.warn { border-left: 4px solid var(--amber); }
.tool-result.bad  { border-left: 4px solid #c23934; }
/* Max three fields per row to prevent crowding; collapses to 2 then 1 on smaller screens */
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
@media (max-width: 700px) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .tool-grid { grid-template-columns: 1fr; } }

/* Opt-in six-across row (used by the 30% ROI Scorecard: Baseline -> Progress) */
.tool-grid.six-up { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .6rem; }
.tool-grid.six-up label span { font-size: .76rem; }
@media (max-width: 900px) { .tool-grid.six-up { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 460px) { .tool-grid.six-up { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Input hint tooltips (financial guidance) */
.tool-hint {
  display: inline-block; margin-left: .35rem; width: 1.05em; height: 1.05em;
  border-radius: 50%; background: var(--line); color: var(--ink);
  font-size: .78em; font-weight: 700; text-align: center; line-height: 1.05em;
  cursor: help; vertical-align: text-top; position: relative;
}
.tool-hint:hover::after, .tool-hint:focus::after {
  content: attr(data-hint);
  position: absolute; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: 1.6em; width: 240px;
  background: var(--navy); color: #fff; font-weight: 400; text-align: left;
  font-size: .8rem; line-height: 1.45; padding: .55rem .7rem; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.meter { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; margin-top: .4rem; }
.meter > span { display: block; height: 100%; background: var(--amber); }

/* ---------- cover page ---------- */
.cover-page { background: var(--navy); color: #e8ebf7; }
.cover { max-width: 66rem; margin: 0 auto; padding: 4rem 1.6rem 2rem; }
.cover-columns {
  display: flex; gap: 3rem; align-items: center;
  padding-bottom: 2.5rem; border-bottom: 0px solid rgba(255,255,255,.15);
}
.cover-book {
  flex: 0 0 480px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 18px;
  padding: 1.4rem;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.cover-book img { display: block; width: 100%; border-radius: 10px; }
.cover-card { flex: 1; text-align: center; }
.cover-actions .btn { margin: 0 .4rem .6rem; }
.btn.buy { background: #fff; color: var(--navy); }
.btn.buy:hover { background: #dfe4f5; }
.cover-signin { font-size: .85rem; color: #8b94b8;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif; }
.cover-signin a { color: var(--amber); }
.access-page .cover-card { max-width: 30rem; margin: 0 auto; border-bottom: none; }
.access-page input[type=email] {
  width: 100%; padding: .6rem .8rem; border-radius: 8px; font-size: 1rem;
  border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08); color: #fff;
}
#access-status { min-height: 1.4em; color: var(--amber); font-size: .9rem;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif; }
.cover-kicker { text-transform: uppercase; letter-spacing: .2em; font-size: .8rem; color: #fff;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif; }
.cover h1 { font-size: clamp(2.4rem, 6vw, 4rem); color: #fff; margin: .4rem 0; }
.cover-subtitle { font-size: 1.25rem; font-style: italic; color: var(--amber); }
.cover-authors { margin-top: 1.6rem; font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .04em; color: #fff; }
.cover-actions { margin-top: 1rem; }
.cover-toc { padding-top: 2.5rem; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; }
.cover-toc h2 { color: var(--amber); letter-spacing: .1em; font-size: 1rem; text-transform: uppercase; }
.cover-toc .nav-part { color: var(--amber); text-transform: uppercase; font-size: .74rem;
  letter-spacing: .08em; margin: 1.4rem 0 .3rem; font-weight: 700; }
.cover-toc ul { list-style: none; padding: 0; margin: 0; column-count: 2; column-gap: 3rem; }
.cover-toc a { color: #dfe4f5; text-decoration: none; display: block; padding: .22rem 0; }
.cover-toc a:hover { color: var(--amber); }
.cover-footer { margin-top: 1rem; text-align: center; color: #8b94b8; font-size: .8rem;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif; 
  border-top: 1px solid rgba(255,255,255,.25); 
}
.cover-callout {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.1rem;              /* a touch smaller than before */
  font-style: italic;
  line-height: 1.6;               /* more air between lines */
  color: #1a1a1a;                 /* near-black reads softer than pure #000 */
  background-color: #ffffff;
  text-align: center;
  padding: 1.5rem 2rem;           /* a bit more generous */
  max-width: 600px;
  margin: 1.5rem auto;
  border-radius: 4px;             /* subtler than 8px */
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);  /* soft lift off the page */
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  #nav-toggle { display: block; }
  #sidebar {
    position: fixed; z-index: 40; left: 0; top: 0; height: 100vh; width: 82vw; max-width: 320px;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open #sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.5); }
  .chapter { padding-top: 4rem; }
  .cover-toc ul { column-count: 1; }
  .cover-columns { flex-direction: column; gap: 2rem; }
  .cover-book { flex-basis: auto; max-width: 260px; margin: 0 auto; }
  .chapter-quote { width: 100%; }
}

/* ---------- print ---------- */
@media print {
  #sidebar, #nav-toggle, .pagers, .search-box, .nav-tools { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .layout { display: block; }
  .chapter { max-width: none; padding: 0; }
  .tool-embed { border: 1px solid #999; box-shadow: none; }
  .tool-print-btn { display: none !important; }

  /* Single-tool printing: when a tool's PDF button is used, body gets
     .print-tool and the chosen embed gets .printing - hide everything else. */
  body.print-tool .chapter > *, body.print-tool .pagers { display: none !important; }
  body.print-tool .chapter > .tool-embed.printing { display: block !important; }
  body.print-tool .tool-embed.printing {
    border: 1pt solid #666; page-break-inside: auto;
  }
  body.print-tool .tool-print-header { display: block !important; }
  /* Printed tools carry no tool title/subtitle: hide the on-screen h4 and
     subtitle (with its Reset link) when printing a single tool. */
  body.print-tool .tool-embed.printing > h4,
  body.print-tool .tool-embed.printing > .tool-sub { display: none !important; }
}
.tool-print-header { display: none; font-family: Georgia, serif; margin-bottom: 8pt;
  border-bottom: 1pt solid #000; padding-bottom: 4pt; }
.tool-print-header .tph-book { font-size: 9pt; color: #444; }
.tool-print-header .tph-date { font-size: 8pt; color: #666; }

/* Quality Dimensions Picker: user-supplied report title/description.
   Hidden on screen (the inputs are the screen UI); swapped in for the
   inputs during single-tool printing so long descriptions don't clip. */
.qd-print-intro { display: none; }
.qd-print-intro .qd-print-title { font-weight: bold; font-size: 12pt; margin: 6pt 0 2pt; }
.qd-print-intro .qd-print-desc { margin: 0 0 8pt; }
@media print {
  body.print-tool .tool-embed.printing .qd-print-intro { display: block; }
  body.print-tool .tool-embed.printing .qd-inputs { display: none !important; }
}

/* Figures inserted via the working-version editor */
.chapter img { display: block; margin: 1.5rem auto; }
