/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Benne&display=swap');

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

/* ── Base ── */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Benne', Georgia, 'Times New Roman', serif;
  font-size: 18px;
  line-height: 1.5;
  color: #383838;
  background: #fff;
}

/* ── Content Layout ── */
.content-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 3.5em 1.2em 2em;
}

/* ── Site Header ── */
.site-header {
  padding: 1.2em 1.2em 0;
  max-width: 720px;
  margin: 0 auto;
}

.site-header a {
  text-decoration: none;
  color: #0a0a0a;
}

.site-title {
  font-family: 'Benne', Georgia, serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #888;
}

.site-title:hover {
  color: #0a0a0a;
}

/* ── Chapter Navigation ── */
.chapter-nav {
  display: flex;
  gap: 0.3em;
  margin-top: 0.6em;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.chapter-nav a {
  font-family: 'Benne', Georgia, serif;
  font-size: 13px;
  text-decoration: none;
  color: #888;
  padding: 0.3em 0.6em;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.chapter-nav a:hover {
  color: #0a0a0a;
  border-color: #999;
}

.chapter-nav a.active {
  color: #0a0a0a;
  border-color: #0a0a0a;
  font-weight: bold;
}

/* ── Typography ── */
h1 {
  font-family: 'Benne', Georgia, serif;
  font-size: 42px;
  font-weight: 400;
  color: #0a0a0a;
  line-height: 1.15;
  margin-bottom: 0.3em;
}

h1 .subtitle {
  display: block;
  font-size: 24px;
  color: #555;
  margin-top: 0.3em;
  font-style: italic;
}

h2 {
  font-family: 'Benne', Georgia, serif;
  font-size: 32px;
  font-weight: bold;
  color: #0a0a0a;
  padding-top: 30px;
  margin-bottom: 0.5em;
  line-height: 1.2;
}

/* First h2 on chapter pages needs no extra top padding */
.content-wrapper > h2:first-of-type {
  padding-top: 0;
}

h3 {
  font-family: 'Benne', Georgia, serif;
  font-size: 24px;
  font-weight: bold;
  color: #0a0a0a;
  padding-top: 28px;
  margin-bottom: 0.4em;
  line-height: 1.3;
}

h4 {
  font-family: 'Benne', Georgia, serif;
  font-size: 20px;
  font-weight: bold;
  color: #0a0a0a;
  padding-top: 18px;
  margin-bottom: 0.3em;
  line-height: 1.3;
}

p {
  margin-bottom: 1.75em;
  text-align: left;
}

a {
  color: #0c0707;
  text-decoration: underline;
}

a:hover {
  color: blue;
}

strong {
  font-weight: bold;
  color: #1a1a1a;
}

em {
  font-style: italic;
}

/* ── Landing Page ── */
.landing-hero {
  text-align: center;
  padding: 4em 0 2em;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 2em;
}

.landing-hero h1 {
  font-size: 48px;
  letter-spacing: 3px;
  margin-bottom: 0.15em;
}

.landing-hero .subtitle {
  font-size: 26px;
  color: #555;
  font-style: italic;
  margin-bottom: 0.6em;
}

.landing-hero p {
  text-align: center;
}

.landing-hero .desc {
  font-size: 16px;
  color: #666;
  margin-bottom: 0.3em;
}

.landing-hero .author {
  font-size: 16px;
  color: #555;
  margin-bottom: 0.2em;
}

.landing-hero .date {
  font-size: 16px;
  color: #555;
}

.landing-hero .draft {
  font-size: 13px;
  font-weight: bold;
  color: #8B0000;
  letter-spacing: 2px;
  margin-top: 1.5em;
}

.landing-hero hr {
  border: none;
  border-top: 1.5px solid #1a1a1a;
  width: 40%;
  margin: 1em auto;
}

/* ── Chapter Index (on landing page) ── */
.chapter-index {
  margin: 2em 0 3em;
  padding: 0;
  list-style: none;
}

.chapter-index li {
  margin-bottom: 0.8em;
}

.chapter-index a {
  font-size: 20px;
  text-decoration: none;
  color: #0a0a0a;
  display: block;
  padding: 0.4em 0;
  border-bottom: 1px solid #f0f0f0;
}

.chapter-index a:hover {
  color: blue;
}

.chapter-index .chapter-num {
  color: #888;
  margin-right: 0.5em;
}

/* ── Callout / Plain English blocks ── */
.callout {
  border-left: 3px solid #ccc;
  background: #f9f9f9;
  padding: 1em 1.2em;
  margin: 1.5em 0 1.75em;
  font-style: italic;
  color: #4a4a4a;
}

.callout p {
  margin-bottom: 0.8em;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* ── Figures / Charts ── */
figure {
  margin: 2em 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid #e8e8e8;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

figcaption {
  font-size: 14px;
  color: #6d6d6d;
  font-style: italic;
  text-align: center;
  margin-top: 0.6em;
  line-height: 1.5;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

figcaption strong {
  font-style: normal;
  color: #4a4a4a;
}

/* ── Tables ── */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 16px;
}

th {
  background-color: #0a0a0a;
  color: #fff;
  padding: 0.5em 0.8em;
  text-align: left;
  font-weight: 400;
}

td {
  padding: 0.4em 0.8em;
  border: 1px solid #ddd;
  vertical-align: top;
}

tr:nth-child(even) {
  background-color: #f8f9fa;
}

/* ── Lists ── */
ul, ol {
  margin: 0.5em 0 1.75em 1.5em;
  line-height: 1.6;
}

li {
  margin-bottom: 0.3em;
}

/* ── Blockquote ── */
blockquote {
  border-left: 3px solid #ccc;
  margin: 1.5em 0;
  padding: 0.8em 1.2em;
  background: #f9f9f9;
  font-style: italic;
  color: #4a4a4a;
}

/* ── Horizontal Rule ── */
hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 2em 0;
}

/* ── Sequential Page Navigation ── */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2em 0;
  margin-top: 3em;
  border-top: 1px solid #e0e0e0;
  gap: 2em;
}

.page-nav a {
  text-decoration: none;
  color: #383838;
  font-size: 16px;
  line-height: 1.4;
  max-width: 48%;
}

.page-nav a:hover {
  color: blue;
}

.page-nav .nav-label {
  display: block;
  font-size: 13px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.2em;
}

.page-nav .nav-prev {
  text-align: left;
}

.page-nav .nav-next {
  text-align: right;
  margin-left: auto;
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 2em 1.2em 3em;
  color: #999;
  font-size: 14px;
  border-top: 1px solid #f0f0f0;
  margin-top: 1em;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.site-footer a {
  color: #888;
}

.site-footer a:hover {
  color: blue;
}

/* ── Sidebar TOC (desktop) ── */
.toc-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 999999;
  height: 100vh;
  width: 280px;
  background: #fff;
  border-left: 1px solid #e8e8e8;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.toc-sidebar.open {
  transform: translateX(0);
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}

/* Tab that sticks out from the sidebar edge */
.toc-tab {
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 120px;
  background: linear-gradient(135deg, #C9A84C, #B8912A);
  border: none;
  border-radius: 4px 0 0 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Benne', Georgia, serif;
  font-size: 12px;
  color: #fff;
  letter-spacing: 1px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: -2px 0 8px rgba(0,0,0,0.12);
}

.toc-tab:hover {
  background: linear-gradient(135deg, #D4B35C, #C9A84C);
  box-shadow: -2px 0 12px rgba(0,0,0,0.18);
}

.toc-sidebar.open .toc-tab {
  background: linear-gradient(135deg, #D4B35C, #C9A84C);
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}

/* Header inside expanded sidebar */
.toc-header {
  padding: 1.5em 1.2em 0.8em;
  border-bottom: 1px solid #f0f0f0;
  font-family: 'Benne', Georgia, serif;
  font-size: 13px;
  font-weight: 400;
  color: #888;
  letter-spacing: 1px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.toc-list {
  list-style: none;
  padding: 0.5em 0 2em;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

/* ── TOC Chapter Structure ── */
.toc-chapter {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-chapter-link {
  display: flex;
  align-items: center;
  padding: 0.45em 1.2em;
  font-size: 14px;
  font-weight: bold;
  color: #383838;
  text-decoration: none;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
  line-height: 1.4;
}

.toc-chapter-link::before {
  content: '\25B8';
  display: inline-block;
  margin-right: 0.4em;
  font-size: 10px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.toc-chapter.expanded > .toc-chapter-link::before {
  transform: rotate(90deg);
}

.toc-chapter-link:hover {
  color: #0a0a0a;
  background: #f8f8f8;
}

.toc-chapter.active > .toc-chapter-link {
  color: #0a0a0a;
  border-left-color: #C9A84C;
}

.toc-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
}

.toc-chapter.expanded .toc-sub {
  display: block;
}

/* ── TOC subsection links ── */
.toc-list .toc-sub a {
  display: block;
  padding: 0.3em 1.2em 0.3em 2.4em;
  font-size: 13px;
  font-weight: normal;
  color: #555;
  text-decoration: none;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.toc-list .toc-sub a:hover {
  color: #0a0a0a;
  background: #f8f8f8;
}

.toc-list .toc-sub a.active {
  color: #0a0a0a;
  border-left-color: #0a0a0a;
  font-weight: bold;
}

.toc-list .toc-sub .toc-h3 {
  padding-left: 3em;
  font-size: 12px;
}

/* ── Mobile TOC (inline) ── */
.toc-inline {
  display: none;
  margin: 1em 0 2em;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

.toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8em 1em;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  color: #0a0a0a;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'Benne', Georgia, serif;
}

.toc-toggle:hover {
  background: #f8f8f8;
}

.toc-toggle .toc-arrow {
  transition: transform 0.2s;
  margin-left: 0.5em;
  font-size: 12px;
}

.toc-inline.open .toc-arrow {
  transform: rotate(90deg);
}

.toc-inline .toc-list {
  padding: 0 0 0.8em;
  max-height: none;
  overflow-y: visible;
  display: none;
}

.toc-inline.open .toc-list {
  display: block;
}

.toc-inline .toc-list a {
  padding: 0.25em 1em;
}

.toc-inline .toc-chapter-link {
  padding: 0.35em 1em;
}

.toc-inline .toc-sub a {
  padding-left: 2em;
}

.toc-inline .toc-sub .toc-h3 {
  padding-left: 2.6em;
}

/* ── Footnote Citations ── */
sup.fn-ref {
  font-size: 0.7em;
  line-height: 0;
  vertical-align: super;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

sup.fn-ref a {
  color: #1A5276;
  text-decoration: none;
  font-weight: 600;
}

sup.fn-ref a:hover {
  color: #2980B9;
  text-decoration: underline;
}

.footnotes {
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid #d0d0d0;
}

.footnotes h2 {
  font-size: 18px;
  color: #888;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding-top: 0;
  margin-bottom: 0.8em;
}

.footnotes ol {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin-left: 1.5em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.footnotes li {
  margin-bottom: 0.5em;
}

.footnotes li:target {
  background-color: #fef9e7;
  border-radius: 3px;
  padding: 2px 4px;
  margin-left: -4px;
}

.footnotes a {
  color: #1A5276;
}

.footnote-backref {
  text-decoration: none !important;
  color: #aaa !important;
  margin-left: 0.3em;
  font-size: 0.9em;
}

.footnote-backref:hover {
  color: #555 !important;
}

/* ── About the Author ── */
.about-author {
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid #d0d0d0;
}

.about-author h2 {
  font-size: 18px;
  color: #888;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.8em;
}

.about-author p {
  font-size: 15px;
  color: #444;
  line-height: 1.7;
}

.about-author a {
  color: #1A5276;
}

.about-author a:hover {
  text-decoration: underline;
}

/* ── Appendix Cards/Panels ── */
.appendix-cards {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  margin: 1.2em 0 1.75em;
}

.appendix-card {
  border-left: 3px solid #1A5276;
  background: #f9f9f9;
  padding: 1em 1.2em;
  border-radius: 0 4px 4px 0;
}

.appendix-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8em;
  margin-bottom: 0.6em;
  flex-wrap: wrap;
}

.appendix-card-header .card-system {
  font-family: 'Benne', Georgia, serif;
  font-size: 18px;
  font-weight: bold;
  color: #1A5276;
}

.appendix-card-header .card-date {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: #888;
  background: #e8e8e8;
  padding: 0.15em 0.6em;
  border-radius: 10px;
  white-space: nowrap;
}

.card-specs {
  list-style: disc;
  margin: 0 0 0 1.5em;
  padding: 0;
  font-size: 16px;
  line-height: 1.6;
}

.card-specs li {
  margin-bottom: 0.2em;
}

/* Note card (e.g. DARPA one-liner) */
.appendix-card-note {
  border-left-color: #C9A84C;
  background: #fef9e7;
}

.appendix-card-note p {
  font-style: italic;
  margin-bottom: 0;
  color: #4a4a4a;
}

/* Roadmap cards */
.appendix-roadmap-card {
  border-left-color: #2E86C1;
}

.card-timeline {
  position: relative;
  padding-left: 24px;
}

/* Vertical line — both line and dots center at 6px from card-timeline edge */
.card-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: #2E86C1;
}

.card-timeline .timeline-item {
  position: relative;
  padding: 0.2em 0;
  font-size: 16px;
  line-height: 1.5;
}

/* Dot: 8px + 2px border each side = 12px. Left edge at 0px → center at 6px */
.card-timeline .timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 7px;
  width: 8px;
  height: 8px;
  background: #2E86C1;
  border: 2px solid #f9f9f9;
  border-radius: 50%;
  box-sizing: content-box;
  z-index: 1;
}

.card-desc {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 0;
}

/* Appendix table */
.appendix-table {
  margin: 1.2em 0 1.75em;
}

.appendix-table td:first-child {
  width: 30%;
  background: #f9f9f9;
  font-weight: bold;
  color: #383838;
  white-space: nowrap;
}

.market-caveat {
  font-size: 14px;
  color: #888;
  font-style: italic;
  margin-top: 0.4em;
  line-height: 1.5;
}

/* ── Inline Photos (contextual images) ── */
.inline-photo {
  margin: 2em auto;
  max-width: 600px;
  text-align: center;
}

.inline-photo img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  border: none;
}

.inline-photo .photo-credit {
  font-size: 13px;
  color: #6d6d6d;
  font-style: italic;
  text-align: center;
  margin-top: 0.5em;
  line-height: 1.5;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.inline-photo .attribution {
  color: #999;
  font-size: 12px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .content-wrapper {
    padding: 2em 0.8em 1.5em;
  }

  .site-header {
    padding: 0.8em 0.8em 0;
  }

  h1 {
    font-size: 32px;
  }

  .landing-hero h1 {
    font-size: 36px;
  }

  h2 {
    font-size: 26px;
  }

  h3 {
    font-size: 22px;
  }

  .toc-sidebar {
    display: none;
  }

  .toc-inline {
    display: block;
  }

  .appendix-card-header {
    flex-direction: column;
    gap: 0.3em;
  }

  .appendix-table td:first-child {
    white-space: normal;
  }

  .appendix-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .page-nav {
    flex-direction: column;
    gap: 1.5em;
  }

  .page-nav a {
    max-width: 100%;
  }

  .page-nav .nav-next {
    text-align: right;
    margin-left: auto;
  }
}

@media (min-width: 769px) {
  .toc-inline {
    display: none;
  }

  .toc-sidebar {
    display: flex;
  }
}

/* ── Print ── */
@media print {
  .toc-sidebar,
  .toc-inline,
  .page-nav,
  .site-header,
  .site-footer {
    display: none;
  }

  .content-wrapper {
    max-width: 100%;
    padding: 0;
  }

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